SWDEV-145570 - Check host_context when matching GPU device.
- In CL#1766264, `host_context` is introduced for mGPU support. Need to
match that context specially when trying to match GPU device context.
The following tests passed:
$ python test_dataloader.py TestDictDataLoader.test_pin_memory
.
----------------------------------------------------------------------
Ran 1 test in 0.004s
OK
$ python test_dataloader.py TestDataLoader.test_sequential_pin_memory
.
----------------------------------------------------------------------
Ran 1 test in 0.063s
OK
$ python test_dataloader.py TestDataLoader.test_shuffle_pin_memory
.
----------------------------------------------------------------------
Ran 1 test in 0.174s
OK
$ python test_dataloader.py TestStringDataLoader.test_shuffle_pin_memory
.
----------------------------------------------------------------------
Ran 1 test in 0.104s
OK
$ python test_torch.py TestTorch.test_pin_memory
.
----------------------------------------------------------------------
Ran 1 test in 0.124s
OK
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#52 edit
+ Fix the error in cmake: clang 8.0.0 supports CUDA 10.0, not 10.1; only trunk clang 9.0.0 supports CUDA 10.1.
+ Update Readme:
1. clang's bug 36384 is gone, so latest stable release for Linux is clang 8.0.0, which supports CUDA up to 10.0;
2. update dependencies, testing and building notes.
Due to a HCC bug in rocm-head, the test fails to compile. Disabling the test until the issue is resolved.
Change-Id: Ib4e7baf0b9c2cb5f5dbe38e6dd2bab894d28886a
SWDEV-144570 - Fix pointer attribute query.
- For memory not registered with runtime, return
`hipErrorInvalidValue`. That's the behavior expected to check whether
a host buffer is pinned.
- Return `hipErrorInvalidDevice` in case a registered memory object
cannot find its matching device.
RB: http://ocltc.amd.com/reviews/r/17094/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#51 edit
SWDEV-145570 - [HIP] Use a context with all devices in system for host register
hipHostRegister and hipMemcpy 0x10 and 0x20 fail in mGPU systems because
we only register the memory on the current device. But in HIP, the registering
needs to happen on all devices.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#17 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#26 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#50 edit
__hipRegisterFunction is called during by .init functions during program initialization.
It calls hipModuleGetFunction to locate kernel symbol in code objects. hipModuleGetFunction
assumes current device when locating kernel symbols. This works for HCC but not for hip-clang,
since hip-clang needs to locate kernel symbols for different devices without switching
between devices.
This patch introduces a new hsa agent parameter to ihipModuleGetFunction, which allows
__hipRegisterFunction to choose the correct hsa agent when locating kernel symbols. By
default it uses this_agent(), therefore this patch has no impact on HCC.
* Make hipModuleGetGlobal be in HIP runtime so it can be discovered at runtime
In HIP PR #929, quite a few HIP public APIs were made as inline functions with
hidden visibility. It was necessary to support applications with shared
libraries with GPU kernels launched via hipLaunchKernelGGL(), after HIP runtime
is initialized.
In empirical tests, the implementation has been proved to be a bit too
excessive, especially for hipModuleGetGlobal(). The function is used by another
type of client applications which relies on the existence of this function
within HIP runtime so global symbols from HSA code objects loaded dynamically
at runtime can be retrieved programmtically.
This commit moves hipModuleGetGlobal() back to src/hip_module.cpp, and makes it
visible and not inline, to fulfill requirements for applications
aforementioned. It does not change the behavior of applications depending on
hipLaunchKernelGGL().
* Add HIP_INIT_API into the implementation of hipModuleGetGlobal
Address review comments.
* Fix failing HIP unit tests
Disambiguate calling many varibles "agent".
More detail in exception message.
Create and discard map placeholders; no need to call std::vector::clear() on map value.