Files
test2/build_files/build_environment/patches/hiprt_baked_bvh_array.diff
Sergey Sharybin 5cd758368a Fix #134992: HIP-RT fails building BVH if Blender path contains space
Quite obscure issue, seemingly caused by the fact that HIP-RT is
passing a large (about 20 MB) global array to a different library
(HIP driver, via hipModuleLoadData). Having global variables of
such size seems to be always problematic as they can not be stored
on stack and, possibly, extra mapping is involved here. It is not
clear whether it is a quirk of the HIP driver, or Linux, or, maybe,
something completely different.

It is possible to work-around the problem by making a temporary
copy of data on heap memory and pass it to the hipModuleLoadData().
This is how other areas are dealing with modules in Blender.

This change contains patch against HIP-RT and the new HIP-RT
library compiled with the patch. It seems to fix the problem
reported in the report.

This change does not resolve OIDN on HIP GPU which seems to have
the same issue. However, it is not a recent regression and the
bug with OIDN GPU denoising can be reproduced using Blender 4.3.

Pull Request: https://projects.blender.org/blender/blender/pulls/135403
2025-03-04 09:35:54 +01:00

22 lines
969 B
Diff

diff --git a/hiprt/impl/Compiler.cpp b/hiprt/impl/Compiler.cpp
index 514667a..509f3f4 100644
--- a/hiprt/impl/Compiler.cpp
+++ b/hiprt/impl/Compiler.cpp
@@ -776,7 +776,15 @@ oroFunction Compiler::getFunctionFromPrecompiledBinary( const std::string& funcN
// kernel.
if constexpr ( UseBakedCompiledKernel )
{
- checkOro( oroModuleLoadData( &module, &bvh_build_array_h ) );
+ // Copy the data into a heap memory.
+ //
+ // Otherwise it seems to be causing issues with access from the HIP SDK when the application binary is
+ // located in a directory with space in it.
+ //
+ // The speculation is that static global memory can not really be megabytes, and access to it requires
+ // mapping of the original file, and this is where things start to go wrong.
+ std::vector<char> binary(bvh_build_array_h, bvh_build_array_h + bvh_build_array_h_size);
+ checkOro( oroModuleLoadData( &module, binary.data() ) );
}
else
{