sorear changed the topic of #riscv to: RISC-V instruction set architecture | https://riscv.org | Logs: https://libera.irclog.whitequark.org/riscv
freakazoid343 has quit [Read error: Connection reset by peer]
freakazoid343 has joined #riscv
kailo has joined #riscv
<kailo> Has anyone run into an issue on archlinux when trying to cross-compile for riscv64 -- failing to link against static libstdc++?
<kailo> /usr/lib/gcc/riscv64-linux-gnu/11.1.0/../../../../riscv64-linux-gnu/bin/ld: cannot find -libstdc++
<cousteau> (shouldn't it be -lstdc++?)
jjido has joined #riscv
<q66> (yes)
<q66> (unless your c++ stdlib is called libibstdc++.so, which it most likely is not)
<kailo> I don't think that's the issue. The problem seems to be exclusive to arch linux, where there is no static library for libstdc++ provided (only the .so) from the riscv64-linux-gnu-binutils package
<kailo> it's being linked with -static-libstdc++ flag in CMakelists.txt, and works fine on other distros
<kailo> I brought it up in #archlinux, and they had me do a search with pacman -Fy libstdc++.a
<jrtc27> *enter libiberty*
<jrtc27> but if you're genuinely seeing -libstdc++ being printed like that something is totally screwed up
<kailo> but only riscv64-elf-gcc seems to include it -- which is for bare metal riscv targets, not riscv/linux (if I understand correctly)
<jrtc27> are you sure you're using -static-libstdc++ and not -static -libstdc++?
<kailo> Yes, and again the makefiles do work on other linux platforms fine. I've cross-compiled for arm32/arm64/riscv64/win64 on debian/ubuntu/arch.. but only arch fails to link on riscv64
<kailo> the same makefiles work natively on a riscv64 host with ubuntu and debian, via unmatched and qemu respectively
<jimwilson> looking at the archlinux riscv64-linux-gnu-gcc package, https://archlinux.org/packages/community/x86_64/riscv64-linux-gnu-gcc/, and going through the file list, I see a file usr/riscv64-linux-gnu/lib/libstdc++fs.a which appears to be the file you want but has the wrong name, looks like an archlinux build or package problem
<jimwilson> kailo, you might be able to fix it with a sudo mv command, use the file and nm commands on the curious file to check to see if it is actually the libstdc++.a file
<q66> libstdc++fs is a different library
<jimwilson> OK, then libstdc++.a is just missing, and this is still an archlinux problem
<q66> it provides stuff in the std::filesystem module from back when it was still in experimental namespace
<q66> you had to explicitly -lstdc++fs back then if you wanted to use it
<q66> i guess to separate its abi
<jrtc27> though if it's not matching that suggests said hack is not in fact needed...
<jrtc27> --enable-default-pie sounds like a bad idea for a gnu bare-metal toolchain
<q66> this is not a bare metal toolchain
<jrtc27> oh wait that's the linux one right
<jrtc27> I was looking at the unknown-elf one earlier
<q66> i don't see anything super wrong in the above file
<jrtc27> well at least one person somewhere is using a bogus -static -libstdc++
<q66> yeah that's wrong
<q66> and it should fail on every toolchain
<q66> the correct way to link libstdc++ statically is -static-libstdc++
<kailo> that's what it's doing
<kailo> and yes @jimwilson, I believe it's just outright missing on arch
riff-IRC has quit [Read error: Connection reset by peer]
riff-IRC has joined #riscv
<q66> yes looks fine
<q66> if the file is missing in the toolchain it's obviously not gonna work
<q66> now find out why it's missing
<q66> or have the maintainers of that package find out
<jrtc27> do you have a log for a failed build?
<q66> that wouldn't help if the toolchain is wrong
<jrtc27> well there are two issues
<q66> and if libstdc++.a is missing, it's wrong
<jrtc27> 1. libstdc++.a is nowhere to be found, which is arch's problem
<jrtc27> 2. -libstdc++.a comes out of nowhere
<jrtc27> 2 should *never* happen
<q66> that could just be a messed up gcc error message :P
<q66> well, linker error in this case
<q66> so binutils
<jrtc27> it's possible binutils mis-parses that, yes
<jrtc27> but it's supposed to be eaten by the driver
Noisytoot has quit [Read error: Connection reset by peer]
<jrtc27> and not make its way to ld at all
<jrtc27> other than via libstdc++.a
<q66> it needs to make its way to the linker if it's linking the shared object
<q66> or attempting to link
<q66> well
<jrtc27> uh, well, -Bstatic -lstdc++ -Bdynamic
<q66> something is bad definitely
<q66> but the libstdc++.a being missing sounds like the primary problem
<q66> if it's really missing, that is
Noisytoot has joined #riscv
<q66> i wouldn't be surprised if there was nothing wrong with the toolchain recipe (i don't see anything wrong anyway) and gcc's build system was somehow messed up
<q66> ever since 9.x or so the qc on gcc has been pretty poor and releases up until at least .2 tend to be unusably buggy
<q66> sometimes .2 included
<q66> and arch does not seem to concern itself very much with toolchain stability
<q66> so they use unpatched vanilla gcc from upstream
<kailo> it's definitely 'really missing'
<kailo> Reaching out to the maintainers now
<q66> for instance https://bugs.archlinux.org/task/68071 never got fixed (other than by updating to gcc11, which implicitly fixed it)
aerkiaga has quit [Remote host closed the connection]
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
shicz2 has quit [Ping timeout: 240 seconds]
shicz2 has joined #riscv
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 250 seconds]
<Sofia> jimwilson: I see.
<Sofia> sorear: At least after a quick look through rocket-chip's chisel/scalar, I don't see any hints for fusion yet. If I understand your statement correctly, you're not aware of _any_ open source implementation which does fusion?
<sorear> I am not aware of any open source risc-v implementation which implements all or even a large fraction of the fusion rules described in Chris Celio's thesis
<sorear> or a non-open-source implementation for that matter
<sorear> Bullet has "short forward branch" fusion which is a very limited subset, I think current BOOM might also have SFB fusion?
<Sofia> Chris Celio's thesis? Have a link?
<Sofia> Okay, so I found that under another path. :) https://people.eecs.berkeley.edu/~krste/papers/EECS-2016-130.pdf
jacklsw has joined #riscv
<Sofia> I expect it suboptimal to use "observations" from benchmarks towards macro-op fusion. Contrast to "what better code could the compiler produce if it could create its own fusions". The fusions directly influence the instruction sequences we generate. We often have many choices we could make, so the observational set is biased to the arbitrary selection.
<Sofia> Either way; if we cannot rely on even this tiny set of macro-op fusions yet... *shrugs*
PyroPeter has quit [Ping timeout: 240 seconds]
PyroPeter has joined #riscv
shicz2 has quit [Ping timeout: 240 seconds]
shicz2 has joined #riscv
theruran has quit [Quit: Connection closed for inactivity]
<dh`> instruction selection in compilers is its own special hellscape :-)
rvalles has quit [Read error: Connection reset by peer]
rvalles has joined #riscv
riff-IRC has quit [Remote host closed the connection]
riff-IRC has joined #riscv
BOKALDO has joined #riscv
<Sofia> dh`: CEGIS and Ruler are interesting in this area. CEGIS specifically for instruction selection rule generation and Ruler is more general for rewrite systems.
smaeul has quit [Quit: Down for maintenance...]
smaeul has joined #riscv
<dh`> had not seen ruler, looks interesting
shicz2 has quit [Ping timeout: 240 seconds]
shicz2 has joined #riscv
EchelonX has quit [Quit: Leaving]
<Sofia> Enjoy
theruran has joined #riscv
<Sofia> dh`: I plan to generalize Ruler to include inequalities and bounded approximations. A la Herbie and its precision-adjusting extension Pherbie. https://herbie.uwplse.org/pldi15.html + https://herbie.uwplse.org/arith21.html
<Sofia> And again more generally to alternative representations. Notably different representations are typically better for certain operations, so weighing which to choose becomes a question of counting which classes of operations you need to use. Or setting a dataflow partition point and switching between the representations if phases of a computation focus on each class of operations.
mahmutov has joined #riscv
jjido has joined #riscv
cousteau has joined #riscv
solrize has quit [Ping timeout: 240 seconds]
jjido has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
solrize has joined #riscv
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
<Sofia> Heh. Experimenting with optimizations I know GCC and LLVM don't try. GCC at least does smarter things than LLVM (breaking li-mul into shifts and adds/subs), but it unnecessarily adjusts the stack pointer, doesn't touch the stack, and adjusts it back. How did that reach GCC's output? Obviously an irrelevant NOP. o.o https://godbolt.org/z/hY41PG6YM
<Sofia> "I'm gonna spill into the stack" "wait no nevermind" "lets leave that garbage there"
___nick___ has joined #riscv
___nick___ has quit [Client Quit]
___nick___ has joined #riscv
<Sofia> Goal: compute x * 27, x * 37. LLVM using li-mul pairs => 5-11 cycles (or 3 cycles if li-mul are fused.. unlikely?). GCC using slli, add, sub (modulo the drunk stack pointer manipulation) => 4-7 cycles, 4 if 2-issue.
<Sofia> Handwritten: 2-5 cycles. 2 if 2-issue and (bitmanip or slli-add fuse). 3 if only 2-issue. 31x := sll x 5; 4x := sll x 2; 5x := add 4x x; 27x := sub 32x 5x; 37x := add 32x 5x.
<Sofia> (I count assuming mul takes 1-4 cycles. Anyone seen any slower RVM implementations?)
<Sofia> Er I also erased register renaming. So LLVM should be 4-10 cycles.
mahmutov has quit [Ping timeout: 256 seconds]
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 240 seconds]
SpaceCoaster has quit [Ping timeout: 256 seconds]
freakazoid12345 has joined #riscv
SpaceCoaster has joined #riscv
freakazoid343 has quit [Ping timeout: 250 seconds]
freakazoid333 has joined #riscv
freakazoid12345 has quit [Ping timeout: 245 seconds]
freakazoid343 has joined #riscv
freakazoid12345 has joined #riscv
freakazoid333 has quit [Ping timeout: 250 seconds]
freakazoid343 has quit [Ping timeout: 260 seconds]
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 268 seconds]
freakazoid333 has joined #riscv
freakazoid343 has quit [Ping timeout: 240 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #riscv
___nick___ has quit [Client Quit]
___nick___ has joined #riscv
mahmutov has joined #riscv
jwillikers has joined #riscv
mahmutov has quit [Ping timeout: 252 seconds]
freakazoid343 has joined #riscv
cousteau has joined #riscv
freakazoid333 has quit [Ping timeout: 250 seconds]
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 260 seconds]
djdelorie has quit [Ping timeout: 250 seconds]
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
jwillikers has quit [Remote host closed the connection]
jwillikers has joined #riscv
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 240 seconds]
cousteau has joined #riscv
freakazoid12345 has joined #riscv
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
cousteau_ has joined #riscv
freakazoid343 has quit [Ping timeout: 260 seconds]
cousteau_ is now known as cousteau
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 240 seconds]
freakazoid12345 has joined #riscv
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
freakazoid343 has quit [Ping timeout: 240 seconds]
djdelorie has joined #riscv
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 252 seconds]
shicz2 has quit [Ping timeout: 256 seconds]
shicz2 has joined #riscv
<jimwilson> removing a stack slot after allocating it is very hard, requires perfect memory disambiguation, though in the best case where all stack slots are removed we should be able to remove the sp adjustments, but this is also hard, and rarely happens
<jimwilson> whether/how multiply gets replaced with shift/add sequences depends on the cost of multiply, which means it depends on exactly which core you are optimizing for
djdelorie has quit [Remote host closed the connection]
jacklsw has quit [Read error: Connection reset by peer]
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 260 seconds]
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 260 seconds]
shicz2 has quit [Ping timeout: 256 seconds]
shicz2 has joined #riscv
jwillikers has quit [Remote host closed the connection]
Noisytoot has quit [Ping timeout: 256 seconds]
elastic_dog has quit [Ping timeout: 240 seconds]
elastic_dog has joined #riscv
elastic_dog has quit [Client Quit]
elastic_dog has joined #riscv
jwillikers has joined #riscv
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 260 seconds]
Noisytoot has joined #riscv
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 245 seconds]
jwillikers has quit [Remote host closed the connection]
solrize has quit [Changing host]
solrize has joined #riscv
djdelorie has joined #riscv
jwillikers has joined #riscv
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 260 seconds]
Andre_H has joined #riscv
jimwilson has quit [Quit: Leaving]
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 260 seconds]
freakazoid333 has joined #riscv
EchelonX has joined #riscv
freakazoid343 has quit [Ping timeout: 252 seconds]
BOKALDO has quit [Quit: Leaving]
shicz2 has quit [Ping timeout: 240 seconds]
freakazoid343 has joined #riscv
shicz2 has joined #riscv
freakazoid333 has quit [Ping timeout: 240 seconds]
jimwilson has joined #riscv
freakazoid12345 has joined #riscv
freakazoid343 has quit [Ping timeout: 245 seconds]
Andre_H has quit [Quit: Leaving.]
freakazoid343 has joined #riscv
freakazoid12345 has quit [Ping timeout: 250 seconds]
Andre_H has joined #riscv
vagrantc has joined #riscv
___nick___ has quit [Ping timeout: 240 seconds]
freakazoid343 has quit [Ping timeout: 250 seconds]
jwillikers has quit [Remote host closed the connection]
Andre_H has quit [Quit: Leaving.]
cousteau has joined #riscv