In this article
A module global is device storage associated with a loaded artifact, not an interchangeable host variable or a perpetual pointer.
Resolve the symbol in the actual module
A runtime loads a kernel artifact and retrieves a global configuration symbol. The module API reference defines hipModuleGetGlobal as a lookup returning a device pointer and size for a named module global. Keep module identity attached to that result. A cached pointer from a previously loaded artifact is not justified merely because a replacement artifact contains a symbol with the same source-level spelling.
Compare the returned byte size
A host configuration structure can change while a cached device artifact still contains the earlier definition. Check the returned global size against the intended representation before copying. A matching symbol name establishes lookup success, not binary layout compatibility. Fields, alignment and data types need an agreed interface. Reject an incompatible size with a useful artifact identity instead of writing the host structure blindly and interpreting a later kernel discrepancy as a numerical inference issue.
Distinguish storage qualifiers from host objects
The HIP language extensions describe device and constant variables. Their storage belongs to device execution semantics. A same-named host object does not automatically refer to that device storage. Plan the permitted transfer operation and ordering explicitly. If multiple requests share a mutable global, ensure one request cannot overwrite configuration still needed by another. The interface may be simpler to reason about with request-specific arguments when shared global state is unnecessary.
Preserve compiled naming and module lifetime
The HIPRTC guide discusses lowered names for compiled symbols. C++ source spelling and the runtime lookup name may differ. Preserve the correct association with the compiled artifact instead of guessing a mangled string. Complete all relevant users before unloading the module or invalidating cached symbol information. Ownership belongs to the loaded module generation, not the lexical scope of the small wrapper that happened to perform the lookup.
Test replacement as well as first load
Use a harmless module with a small configuration global and checked kernel output. Exercise the intended load, lookup, update and completion sequence, then verify cache invalidation when replacing the artifact. Related guides on software reproducibility and HIP launch portability provide background. This topic’s evidence is exact symbol storage and lifecycle. Successful module loading alone does not establish a compatible global layout, a valid cached address or request-safe mutation of shared device state.
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.