llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

Add "align" option for `IRBuilder.alloca`

Open isVoid opened this issue 2 years ago • 2 comments

In official LLVMIR documentation , the alloca instruction has an optional align argument (at least in textural representation). When not specified, it is up to the target to choose a "convenient" boundary for the type. llvmlite's alloca instruction doesn't have this argument and is always restricted to the target's alignment. This could leave some performance optimization on the table.

isVoid avatar Apr 23 '24 04:04 isVoid

I think this could also be a correctness issue if we're aiming to interoperate with code that requires particular alignment of structures - for example, IIRC complex values on CUDA are represented by a struct of 2 floats with an 8-byte alignment even when the natural alignment for that struct would be 4 bytes (I think @nvlcambier and I ran into this).

gmarkall avatar Apr 23 '24 11:04 gmarkall

Bumped into this issue too today, 1 year later. I would also appreciate it if the "addrspace" option could also be added.

eliphatfs avatar May 24 '25 05:05 eliphatfs