You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to 1.0.3, calling hsa_init() on a non-HSA platform (such as an Intel CPU) was well behaved. I believe the behaviour was that hsa_init() succeeded, but that the runtime would report no agents or regions to the hsa_iterate_*.
With the 1.0.3 release, hsa_init segfaults. This is due to this line:
// Setup system region allocator.
if (reinterpret_castamd::MemoryRegion*(
core::MemoryRegion::Convert(system_region_))->fine_grain()) {
On non-HSA platforms, system_region_.handle == 0, so the call to fine_grain() dereferences a null pointer.
Having hsa_init() fail cleanly, or restoring the previous behaviour, where hsa_init() succeeds, but no agents and regions are reported would be preferable to a segfault.
It appears that simply adding a check for a null system_region_ restores this behaviour.
Confirming the problem (master branch: commit 576359e "HSA 1.0.3 Source"):
[...]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff564e579 in core::Runtime::Load() () from [...]/libhsa-runtime64.so.1
(gdb) bt
#0 0x00007ffff564e579 in core::Runtime::Load() () from [...]/libhsa-runtime64.so.1
#1 0x00007ffff564d0ee in core::Runtime::Acquire() () from [...]/libhsa-runtime64.so.1
#2 0x00007ffff563910a in HSA::hsa_init() () from [...]/libhsa-runtime64.so.1
#3 0x00007ffff565e074 in hsa_init () from [...]/libhsa-runtime64.so.1
[...]
..., and that the patch posted by @r-potter, resolves this.
Prior to 1.0.3, calling hsa_init() on a non-HSA platform (such as an Intel CPU) was well behaved. I believe the behaviour was that hsa_init() succeeded, but that the runtime would report no agents or regions to the hsa_iterate_*.
With the 1.0.3 release, hsa_init segfaults. This is due to this line:
// Setup system region allocator.
if (reinterpret_castamd::MemoryRegion*(
core::MemoryRegion::Convert(system_region_))->fine_grain()) {
On non-HSA platforms, system_region_.handle == 0, so the call to fine_grain() dereferences a null pointer.
Having hsa_init() fail cleanly, or restoring the previous behaviour, where hsa_init() succeeds, but no agents and regions are reported would be preferable to a segfault.
It appears that simply adding a check for a null system_region_ restores this behaviour.
runtime.patch.txt
The text was updated successfully, but these errors were encountered: