Skip to content

PTX: Demote GEP indices to 32 bits, if possible. #463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maleadt opened this issue May 31, 2023 · 0 comments
Open

PTX: Demote GEP indices to 32 bits, if possible. #463

maleadt opened this issue May 31, 2023 · 0 comments
Labels
ptx Stuff about the NVIDIA PTX back-end.

Comments

@maleadt
Copy link
Member

maleadt commented May 31, 2023

In JuliaGPU/CUDA.jl#1895, I made the size tuple of CuDeviceArray 32 bits so that we can emit better code (lowering register pressure, making it possible to execute compute & indexing instructions in parallel, etc) However, the NVPTX back-end defaults to using 64 bits for indexing pointers, resulting in 64-bits GEPs being introduced by the front-end and optimization. I tried to change that by specifying a 32-bit pointer index size in the data layout, #444, but that breaks 64-bits indices which can still get reintroduced by optimization (see e.g. #461).

Either we try this again on LLVM 17 (where a bug has been fixed that was introducing 64-bits GEP offsets), or we instead create an optimization pass that demotes GEP indices to 32 bits if possible (e.g., if they are constants, or come from the size field of a device array).

@maleadt maleadt added the ptx Stuff about the NVIDIA PTX back-end. label May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ptx Stuff about the NVIDIA PTX back-end.
Projects
None yet
Development

No branches or pull requests

1 participant