HSAFoundation / HSAIL-HLC-Stable

LLVM-based high-level-compiler (HLC) that generates HSAIL. The Stable version includes optimizations, atomics, and is provided in binary form. See also the HSAIL-HLC-Development version for other options.
Other
14 stars 3 forks source link

accept explicit alignment for kernel arguments #2

Open whchung opened 10 years ago

whchung commented 10 years ago

I'm wondering would it be possible to let HSAIL backend support manually specifying alignment for kernel arguments?

For example, if C++ AMP emit the following IR:

define internal cc76 void @foo(i32 align 8) { ret void }

then HSAIL backend will generate the following HSAIL:

prog kernel &foo( align(8) kernarg_u32 %__arg_p1 ) { ret; }

The rationale is because in C++AMP runtime we use std::vector to hold all kernel arguments prior to kernel launch. This is copied from Okra runtime implementation. And right now we use "sed" to hack HSAIL emitted by HSAIL backend to make sure all kernargs are 8-bytes aligned. But if we move to BRIG then such hack won't work anymore.

alienanthill commented 10 years ago

Currently, is the back-end stripping the alignments information?

whchung commented 10 years ago

Yes, the alignment information is ignored by HSAIL backend right now.