cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

zoomzoom
Adept I

How to launch an HSAIL kernel (no BRIG)

Let's say that we have an HSAIL kernel either written by us or obtained with CLOC from an OpenCL kernel file.

How can this kernel be launched?

According to the "HSA Programmer's Reference Manual 1.0 Provisional" (page 1) HSAIL code can be natively supported by the hardware or it may require a finalizer to translate it to the hardware specific native ISA.

How can one tell if a device supports HSAIL natively?

How can the finalizer be invoked for HSAIL code?

If I'm not wrong, the "HSAIL Finalization", "HSAIL Linking" chapters from the "HSA-System-Runtime-Specification-Provisional-1.0" refer only to BRIG. But what if the input code is in HSAIL format?

The same "HSA Programmer's Reference Manual 1.0 Provisional" says that an HSA implementation should include a finalizer for "translating HSAIL code into the appropriate native ISA [...]" (page 1). Shouldn't then the API for the finalizer be part of the core API and not an HSA exension?

Thanks.

0 Likes
1 Solution
jedwards
Staff

The final specifications for HSA were published on March 16, 2015 and have changed significantly from the provisional versions. One of the greatest changes occurred in the sections pertaining to code objects, executables (section 2.8 in the HSA Runtime specification) and HSAIL finalization (section 3.1 in the HSA Runtime specification). Answers to specific questions follow, but are consistent with the final HSA specification:

Q) How can one tell if a device supports HSAIL natively?

A) An agent never supports HSAIL natively. A code object will have a specific ISA format that can be matched with an agent. The code object's ISA format can be queried using the hsa_code_object_get_info API using the HSA_CODE_OBJECT_INFO_ISA attribute. The agent's supported ISA attribute can be queried using hsa_agent_get_info API using the HSA_AGENT_INFO_ISA attribute. Finally, use the has_isa_compatible API to determine if the two ISA versions are compatible. There are now API's that allow directly loading stored code object from a file and translating them into code objects (serialize/deserialize).

Q) How can the finalizer be invoked for HSAIL code?

A) Currently the finalizer only consumes HSAIL in BRIG format. Any tool that translates HSAIL text to HSAIL BRIG is currently not part of the HSA specification. Vendors can create tools that perform the translation, and AMD specifically has one: HSAFoundation/HSAIL-HLC-Stable · GitHub. This version currently translates to 1.0 P BRIG but this should be updated soon.

Q) If I'm not wrong, the "HSAIL Finalization", "HSAIL Linking" chapters from the "HSA-System-Runtime-Specification-Provisional-1.0" refer only to BRIG. But what if the input code is in HSAIL format?

A) BRIG is the only format currently supported by HSAIL Finalization. The tools available in the HSAIL-HLC-Stable release mentioned above provide translation.

Q) ... Shouldn't then the API for the finalizer be part of the core API and not an HSA exension?

A) No, because some vendors may not want to support HSAIL or finalization. They may want to provide their own compilers and/or object code. The new APIs allow them to do this without supporting finalization.

View solution in original post

0 Likes
1 Reply
jedwards
Staff

The final specifications for HSA were published on March 16, 2015 and have changed significantly from the provisional versions. One of the greatest changes occurred in the sections pertaining to code objects, executables (section 2.8 in the HSA Runtime specification) and HSAIL finalization (section 3.1 in the HSA Runtime specification). Answers to specific questions follow, but are consistent with the final HSA specification:

Q) How can one tell if a device supports HSAIL natively?

A) An agent never supports HSAIL natively. A code object will have a specific ISA format that can be matched with an agent. The code object's ISA format can be queried using the hsa_code_object_get_info API using the HSA_CODE_OBJECT_INFO_ISA attribute. The agent's supported ISA attribute can be queried using hsa_agent_get_info API using the HSA_AGENT_INFO_ISA attribute. Finally, use the has_isa_compatible API to determine if the two ISA versions are compatible. There are now API's that allow directly loading stored code object from a file and translating them into code objects (serialize/deserialize).

Q) How can the finalizer be invoked for HSAIL code?

A) Currently the finalizer only consumes HSAIL in BRIG format. Any tool that translates HSAIL text to HSAIL BRIG is currently not part of the HSA specification. Vendors can create tools that perform the translation, and AMD specifically has one: HSAFoundation/HSAIL-HLC-Stable · GitHub. This version currently translates to 1.0 P BRIG but this should be updated soon.

Q) If I'm not wrong, the "HSAIL Finalization", "HSAIL Linking" chapters from the "HSA-System-Runtime-Specification-Provisional-1.0" refer only to BRIG. But what if the input code is in HSAIL format?

A) BRIG is the only format currently supported by HSAIL Finalization. The tools available in the HSAIL-HLC-Stable release mentioned above provide translation.

Q) ... Shouldn't then the API for the finalizer be part of the core API and not an HSA exension?

A) No, because some vendors may not want to support HSAIL or finalization. They may want to provide their own compilers and/or object code. The new APIs allow them to do this without supporting finalization.

0 Likes