TECHNOLOGY

HIPRTC headers: the include name and supplied source are part of the compiled artifact

In this article
THE QUICK TAKE

A runtime compiler sees a declared compilation input set; the host program having included a header does not supply that header to the runtime program.

Separate the host build from the generated program

A C++ service includes a tensor-layout header and constructs a kernel as a string. That kernel cannot assume that the service’s host preprocessor already supplied the same definitions. The HIPRTC programming guide describes runtime program construction and provided headers. Treat the generated program as a separate compilation unit with declared inputs. Host executable build success is not evidence that the runtime source can resolve every dependency it mentions.

Pair include names with actual contents

The runtime compilation API exposes header-source and include-name arrays when creating a program. Preserve their correspondence. A supplied layout header under one virtual name does not automatically satisfy a different include spelling used by generated code. Build a manifest of source text, names and contents instead of debugging a missing definition solely through the application’s filesystem. Check nested dependencies as well as the first directly included file.

Do not inherit host configuration accidentally

A macro used when compiling the host service does not necessarily have the same value during runtime compilation. Record device compilation options, target selection and generated definitions explicitly. For example, a stride type or alignment constant that differs between host-generated arguments and device code can compile successfully while describing incompatible data. Keep the schema used to build arguments connected to the schema compiled into the kernel, rather than treating a common header filename as proof of identical contents.

Preserve diagnostics and input identity

The HIPRTC declarations expose program creation, compilation and diagnostic-log operations. Save the log on failure alongside a non-sensitive input identity and options. A cache keyed only by the kernel string misses changes in injected header contents. Include every compilation-affecting dependency in the cache policy. This is a reproducibility requirement, not a recommendation to print proprietary source or request data into operational logs.

Check a dependency change deliberately

Use a small generated kernel whose output depends on a declared header constant. Change that header and verify the cache selects the intended compiled artifact and checked output. Related guides cover reproducible software stacks and HIP portability. The specific boundary here is compilation input ownership: runtime source, provided headers and options form an artifact together, independently of what the host application happened to include during its own build.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles