CHIP-SPV / chipStar

chipStar is a tool for compiling and running HIP/CUDA on SPIR-V via OpenCL or Level Zero APIs.
Other
184 stars 29 forks source link

chipStar tests may fail because of getHIPCCPath picking up wrong hipcc binary #715

Closed franz closed 9 months ago

franz commented 9 months ago

Some hiprtc tests can fail because of how hiprtcCompileProgram works: hiprtcCompileProgram calls getHIPCCPath which prefers the installed hipcc (for release builds, see code snippet below). So if e.g. the user runs cmake with CMAKE_BUILD_TYPE=Release and identical CMAKE_INSTALL_PREFIX for multiple different chipStar builds, and forgets to call make install, the hiprtc tests will call hipcc from whatever build is currently installed in the prefix.

    for (const auto &ExeCand : {
#if !CHIP_DEBUG_BUILD
           fs::path(CHIP_INSTALL_DIR) / "bin/hipcc",
#endif
               fs::path(CHIP_BUILD_DIR) / "bin/hipcc"
         })
      if (canExecuteHipcc(ExeCand)) {
        HIPCCPath = ExeCand;
        return;
      }
    }

There should be a way to force the tests only use hipcc from build directory, and use it with ctest / check.py. One solution is to switch above code to always use CHIP_BUILD_DIR first, another way is an extra environment variable, another a cmake option. @pvelesko @pjaaskel @linehill preferred solution ?

pvelesko commented 9 months ago

I think we should check where the .so is located all call the hipcc based on that dir

linehill commented 9 months ago

I think we should check where the .so is located all call the hipcc based on that dir

+1.

pjaaskel commented 9 months ago

In PoCL we use an environment variable POCL_BUILDING to direct to use build dir data (bitcode lib etc.), but the .so path still needs to be set in LD_LIBRARY_PATH (in this case in check.py perhaps?). Perhaps we can use the same idea here?