#llvm

mirek kratochvilexa@mastodon.online
2025-05-04

What's your favorite way of compiling stuff to assembly (preferably supporting a few different target archs), but other than LLVM?

Are there any actual sensible alternatives now?

#programming #compilers #compilation #assembly #llvm

Jesper Stemann Andersenstemann
2025-05-03

Remarkable how easy it is to inspect different levels of in - from intermediate representations, through IR, to native, e.g.:
```
julia> @code_llvm 1+2
; Function Signature: +(Int64, Int64)
; @ int.jl:87 within `+`
define i64 @"julia_+_735"(i64 signext %"x::Int64", i64 signext %"y::Int64") #0 {
top:
%0 = add i64 %"y::Int64", %"x::Int64"
ret i64 %0
}
```

But there is no `@code_source` macro (should return, e.g., `1 + 2`) 😊

(Most 👍 in repo): github.com/JuliaLang/julia/iss

mgorny-nyan (on) :autism:🙀🚂🐧mgorny@pol.social
2025-05-03

Wyolbrzymione:

#Intel: w końcu obsługujemy #LLVM 16!
Użytkownik: u mnie się nie kompiluje z LLVM 16.
Intel: u nas działa, potrzebujesz tej łatki.
Użytkownik: ale ta łatka sprawia, że LLVM 15 buduje się jako wersja 16.x.
Intel: …
Użytkownik: …
Intel: jak już mówiliśmy, wspieramy LLVM 16!

github.com/intel/intel-graphic

mgorny-nyan (he) :autism:🙀🚂🐧mgorny@treehouse.systems
2025-05-03

Exaggerated:

#Intel: we finally support #LLVM 16!
User: but it fails to build against LLVM 16.
Intel: it builds for us, you just need this patch.
User: but this patch makes LLVM 15 build as 16.x.
Intel: …
User: …
Intel: so yes, we support LLVM 16 now!

github.com/intel/intel-graphic

2025-04-30

[Перевод] Golang на PlayStation 2

Мне всегда хотелось творить какую-нибудь дичь с консолями. Не знаю почему, но меня всегда привлекала идея реализовывать на устройствах неожиданные возможности. Это относится и к PlayStation 2 , выпущенной Sony в 2000 году. Sony, пожалуйста, не подавайте в суд на меня за этот пост. Перейдём сразу к делу: я хочу научиться запускать код на консолях (подробнее о том, зачем это нужно, я расскажу в другом посте). Обычно это делается на языках низкого уровня, но сегодня мы можем проще и удобнее работать с языками наподобие Go . Поэтому я подумал: почему бы и нет? Поискав онлайн, я не нашёл простого решения, поэтому взялся за эту задачу самостоятельно.

habr.com/ru/articles/895322/

#playstation_2 #golang #clang #llvm #llvm_ir #mips

2025-04-29

Mark your calendars! Next #LLVM #Meetup #Darmstadt happening on May 28th 2025, starting 7pm.

We will have three shorter talks to cover a variety of cool topics around #compilers and #tooling support. \o/

Check out the agenda and RSVP at meetup.com/llvm-social-darmsta

#Software #HPC #Clang
@llvmweekly @llvm

Ramkumar Ramachandraartagnon@mathstodon.xyz
2025-04-28
2025-04-26

Exploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the Performance Impact

web.ist.utl.pt/nuno.lopes/pubs

#cpp #llvm #performance #coding

image/jpeg
2025-04-23

Someone did a study on the performance impact of exploiting undefined behaviour in C/C++: web.ist.utl.pt/nuno.lopes/pubs

> "[...] we demonstrate that, for the benchmarks and UB categories that we evaluated, the end-to-end performance gains are minimal. Moreover, when performance regresses, it can often be recovered through small improvements to optimization algorithms or by using link-time optimizations."

#coding #programming #compilers #llvm

mgorny-nyan (on) :autism:🙀🚂🐧mgorny@pol.social
2025-04-19

Aktualizacja w temacie #mitmproxy, czyli jak nie zamierzałem spędzać soboty.

Poprzednio: pol.social/@mgorny/11436480116

Tak więc:

1. Z pomocą osoby nickiem vadorovsky, dowiedziałem się, że jak dam --no-default-features, to bpf-linker użyje systemowego LLVM, i w ten sposób pozbyłem się problemów nr. 2 i 4.
2. #LLVM 20 nadal się sypie, ale jakimś cudem wtorkowy snapshot LLVM 21 działa.
3. Musiałem wrzucić btfdump na potrzeby testów, ale teraz wszystkie przechodzą.
4. Zmarnowałem godziny na budowanie mitmproxy-linux, ale w końcu znalazłem sposób. Otóż, okazuje się, że muszę wywalić logikę budowania binarek w formacie bpf z tej paczki, zbudować je ręcznie z poprawną wartością RUSTFLAGS, a potem połączyć to w całość. github.com/mitmproxy/mitmproxy
5. Problem z rustc-build-sysroot jest jeszcze gorszy w mitmproxy-linux.
6. Testy mitmproxy-linux segfaulcą (jak to #RustLang).
7. Ale jak już wszystko poinstaluję, to testy mitmproxy przechodzą.

Więc zostaje mi wymyślić, co zrobić z tymi segfaulcącymi testami, i myślę, że nowa wersja mitmproxy może wylądować w #Gentoo. Przypięta do pojedynczej wersji kompilatora Rusta, ale zawsze coś.

mgorny-nyan (he) :autism:🙀🚂🐧mgorny@treehouse.systems
2025-04-19

#mitmproxy update AKA not how I imagined spending my Saturday.

Previous post: social.treehouse.systems/@mgor

So:

1. With help of vadorovsky, I've learned that I need to pass --no-default-features, and then it uses system LLVM which resolves problems 2. and 4.
2. #LLVM 20 still fails on that assertion, but Tuesday's LLVM 21 snapshot works fine.
3. I also needed to package btfdump for bpf-linker's tests but I was finally able to get them to pass.
4. After spending hours trying to figure out mitmproxy-linux build failures, I've finally found a way to build it: I need to remove upstream's logic for building bpf binaries, build them manually with correct RUSTFLAGS, and then build the whole thing. github.com/mitmproxy/mitmproxy
5. rustc-build-sysroot crate problem is even worse in mitmproxy-linux.
6. mitmproxy-linux's tests segfault (yeah, #RustLang).
7. But still, with the packages built, I can get tests to pass on mitmproxy itself.

So yeah, if I can only figure out what to do about these segfaulting tests, I think we can get new mitmproxy version into #Gentoo. Pinned to one Rust version, but that's better than nothing, I guess.

mgorny-nyan (on) :autism:🙀🚂🐧mgorny@pol.social
2025-04-19

Zmarnowałem kolejną godzinę na użeranie się z próbą dodania bpf-linker / nowej wersji #mitmproxy do #Gentoo. Podsumowując:

1. Wymaga funkcji, dostępnych wyłącznie w eksperymentalnych wersjach kompilatora #RustLang. Można to obejść, ustawiając RUSTC_BOOTSTRAP=1. github.com/aya-rs/bpf-linker/i
2. Wymaga innych wersji kilku bibliotek poprzez zależność aya-rustc-llvm-proxy, jakimś cudem. Można to albo rozwiązać dodając do ebuilda owe wersje, albo usuwając z wypakowanego archiwum plik `Cargo.lock`.
3. Wymaga `compiler_builts` poprzez zależność rustc-build-sysroot. Co ciekawe, konkretna wersja jest przypięta wewnątrz biblioteki standardowej Rusta, więc musiałbym dodać odpowiednią wersję zależności dla każdej obsługiwanej wersji kompilatora!
4. Ma własną logikę wyszukiwania biblioteki #LLVM, która porusza się po PATH i podmienia `bin` na `lib`. Tak, na katalog z 32-bitowymi bibliotekami. Da się to obejść, ustawiając LD_LIBRARY_PATH. github.com/aya-rs/bpf-linker/i
5. Nawet jak obejdę wszystkie inne problemy, to koniec konców się sypie na użyciu LLVM. Zgaduję, że nikomu nie przyszło do głowy użyć do testów LLVM z kontrolą poprawności użycia API. github.com/aya-rs/bpf-linker/i

No cóż, taka jakość programów pisanych w Ruście. Co gorsza, te wszystkie problemy dotyczą nie budowania, a uruchamiania bpf-linkera — więc tak czy siak, instalowalibyśmy program, który w ogóle nie działa bez dodatkowych obejść.

mgorny-nyan (he) :autism:🙀🚂🐧mgorny@treehouse.systems
2025-04-19

Spent another hour on trying to get bpf-linker / new #mitmproxy into #Gentoo. To summarize:

1. It needs features from nightly #RustLang compiler at runtime. This can be worked around via setting RUSTC_BOOTSTRAP=1. github.com/aya-rs/bpf-linker/i
2. It needs different pinned versions of some libraries via aya-rustc-llvm-proxy somehow. This can be solved via manually adding more crates to the ebuild (sigh) or just removing the extra `Cargo.lock` from the crate.
3. It needs `compiler_builtins` crate via rustc-build-sysroot crate. Funny enough, the version is pinned by Rust standard library itself, so I need to add a specific crate for every supported Rust compiler version!
4. It uses a homemade logic to find #LLVM library, which iterates over PATH and replaces `bin` with `lib`. Yes, with 32-bit libdir. It can be worked around via setting LD_LIBRARY_PATH. github.com/aya-rs/bpf-linker/i
5. Even after working around all these issues, it crashes by triggering an assertion in LLVM. I guess nobody bothered testing with assertions enabled, as usual. github.com/aya-rs/bpf-linker/i

So yeah, that's your Rust quality. On top of that, let's not forget that this is all runtime issues — like we would be installed a bpf-linker executable that's nonfunctional unless you apply workarounds.

Ramkumar Ramachandraartagnon@mathstodon.xyz
2025-04-18

@mgorny The #LLVM Foundation is non-profit, and the high ticket prices are somewhat unfortunate: the venue wasn’t cheap, and we insist on high-quality recordings. I agree that many of the corporate contributors are irresponsible, but there’s also a good share of people on retainers, who pretty much get to do what they want. Not sure I’d classify the major people (Florian, Nikita, Matt, Craig) as “corporate contributors”.

रञ्जित (Ranjit Mathew)rmathew
2025-04-18
2025-04-14

Watch Full-stack Linux dev fix #LLVM. #Clang & #Rust for #Mesa3D and other SPARC details! youtube.com/watch?v=UV7wYDXKBP

mgorny-nyan (on) :autism:🙀🚂🐧mgorny@pol.social
2025-04-13

#EuroLLVM to świetna okazja, by porozmawiać o społeczności #LLVM. Nie, nie na konferencji.

Jeżeli kiedykolwiek mieliście jakiekolwiek wątpliwości co do tego, jaki stosunek do wolontariuszy ma owa społeczność, wystarczy spojrzeć na ceny biletów. Który wolontariusz wyrzuci $750 z własnej kieszeni za wstęp?!

No ale dobra, znamy swoje miejsce. My jesteśmy od tego, żeby poświęcać swoje weekendy na naprawianie tego, co państwo korporacjusze zepsują w tygodniu. A następnie proszenia się, żeby przejrzeli nasze poprawki, zanim zepsują kolejną rzecz. A w tym czasie jaśnie wielmożni będą radzić, jak zgotować nam jeszcze gorszą przyszłość.

llvm.swoogo.com/2025eurollvm

#OpenSource

mgorny-nyan (he) :autism:🙀🚂🐧mgorny@treehouse.systems
2025-04-13

#EuroLLVM is a good opportunity to talk of the #LLVM community. No, not at the conference.

Because if you ever were wondering what LLVM project's attitude towards its volunteer contributors is, just look at the ticket prices. I mean, which volunteer would spend $750 on a conference ticket?!

But yeah, we know our place. It's to spend weekends fixing what corporate contributors broke through the week, then beg them to actually review our fixes before they break more. And in the meantime, our gracious lords will debate how to mess up our future even more.

llvm.swoogo.com/2025eurollvm

#OpenSource

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst