hcc icon indicating copy to clipboard operation
hcc copied to clipboard

Compilation time architecture (ISA) differentiation

Open jszuppe opened this issue 7 years ago • 2 comments

I would like to change some complication-time variables (template parameters) based on AMD target architecture passed to hcc. This is for performance reasons (each architecture has different sweet spot). Is there any way to get information about architecture (ISA) during compilation (of device functions)?

jszuppe avatar May 04 '18 10:05 jszuppe

We currently don't support this due to a limitation in hcc on how we support multiple architecture in a single binary file. Our frontend currently only parses the source code once for all architectures and then the resulting LLVM IR would be reused to generate ISA for all GPU architectures.

We are planning on changing this such that the source would be parsed once per architecture and that there would be predefined macros for the GPU arch being targeted for that particular compilation instance. The work is being planned for some time this year.

For now, the workaround would be to specify a macro through a command line flag (e.g. -D ) to enable the specialized code path you want to enable and to build a separate binary file for the architecture you want to optimize for.

scchan avatar May 08 '18 19:05 scchan

Thanks. We will try to incorporate some workaround(s) as you suggested.

jszuppe avatar May 08 '18 20:05 jszuppe