Repository navigation
Conversation
|
Thank you for also solving the fixme along the way. I'm at the llvm dev till wednesday, but I'll try to test it a bit in between. @kjetilkjeka you had some ideas on how to configure cpu vs gpu builds, right? fyi @xkevio |
|
For my cargo experiment with offload support this is a step in the right direction, with a little regression. It fits well within the model of building a single "cdylib" (ptx/elf) for the device compilation per binary (as opposed to one per crate). The unfortunate regression is of course that a crate with a single I checked out your PR and added a mapping in I haven't got far enough to test |
This comment has been minimized.
This comment has been minimized.
|
Thanks. I agree that independently of the final design we almost never want to compile the GPU code as a normal binary, even if libc-for-gpu might allow us to do such cursed/funny things. So for now mapping the GPU cratetype seems like the right call, @sgasho can you try to add that? I'd expect that if we remap it early enough it should be unproblematic |
0d7ede9 to
4e185cd
Compare
|
Thanks both. I added the Executable → Cdylib mapping in |
|
Thanks, another hundred lines saved. I tested it on an AMD igpu, where it also works. |
|
☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
|
@bors delegate r=me when rebased |
|
Invalid command: Key-value argument |
|
@bors delegate lgtm, after rebase |
|
Unknown argument "lgtm,". Did you mean to use |
|
I thought bors now allows comments following the command? But I guess that's just for r+. lgtm, after rebase @bors delegate |
Closes #164057
Follow-up to: #164455
The host pass now takes the linked device output (
<crate>.ptxfor NVPTX,<crate>.elffor AMDGPU) instead of the device bitcode.The device crate must now be built as a cdylib. rustc only passes --export-symbol to llvm-bitcode-linker for cdylibs, so a bin would lose its kernels to internalization.
I had to add [lib] in Cargo.toml
Without it, the runtime fails at startup
I’m not sure whether bin device crates should export their kernels too, so I left the linker untouched for now.
The second commit fixes another runtime error without
--emit=llvm-bc/llvm-ir. (my understanding is that we should not have to set these after this PR, because no device.bc anymore)The “already wrapped” check in handle_offload relied on a value name, which LLVM drops unless --emit=llvm-bc/llvm-ir is given, so the kernel got wrapped twice.
I verified on UofT nvidia gpunode (amdgpunodes was not available for my account).
r? ZuseZ4