Skip to content

Commit 31e3f6b

Browse files
noelchalmersdmed256
authored andcommitted
[GPU] Forwarding getMappedPtr changes to HIP
1 parent 5e8e5ac commit 31e3f6b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/occa/mode/hip/memory.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ namespace occa {
4141
const udim_t bytes,
4242
const occa::properties &props);
4343

44+
friend void* getMappedPtr(occa::memory mem);
45+
4446
public:
4547
hipDeviceptr_t hipPtr;
4648
char *mappedPtr;

include/occa/mode/hip/utils.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ namespace occa {
9696

9797
hipCtx_t getContext(occa::device device);
9898

99+
void* getMappedPtr(occa::memory mem);
100+
99101
occa::device wrapDevice(hipDevice_t device,
100102
hipCtx_t context,
101103
const occa::properties &props = occa::properties());

src/mode/hip/utils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ namespace occa {
177177
return ((hip::device*) device.getModeDevice())->hipContext;
178178
}
179179

180+
void* getMappedPtr(occa::memory mem) {
181+
hip::memory *handle = (hip::memory*) mem.getMHandle();
182+
return handle ? handle->mappedPtr : NULL;
183+
}
184+
180185
occa::device wrapDevice(hipDevice_t device,
181186
hipCtx_t context,
182187
const occa::properties &props) {

0 commit comments

Comments
 (0)