Skip to content

Commit

Permalink
Moved changes to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Kusiak authored and konradkusiak97 committed Jan 31, 2024
1 parent d779c95 commit 0235cd0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions source/adapters/hip/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ struct ur_device_handle_t_ {
ur_device_handle_t_(native_type HipDevice, hipCtx_t Context,
ur_platform_handle_t Platform, uint32_t DeviceIndex)
: HIPDevice(HipDevice), RefCount{1}, Platform(Platform),
HIPContext(Context), DeviceIndex(DeviceIndex) {}

~ur_device_handle_t_() noexcept(false) {
UR_CHECK_ERROR(hipDevicePrimaryCtxRelease(HIPDevice));
HIPContext(Context), DeviceIndex(DeviceIndex) {

UR_CHECK_ERROR(hipDeviceGetAttribute(
&DeviceMaxLocalMem, hipDeviceAttributeMaxSharedMemoryPerBlock,
HIPDevice));
UR_CHECK_ERROR(hipDeviceGetAttribute(
&ManagedMemSupport, hipDeviceAttributeManagedMemory,
HIPDevice));
&ManagedMemSupport, hipDeviceAttributeManagedMemory, HIPDevice));
}

~ur_device_handle_t_() noexcept(false) {
UR_CHECK_ERROR(hipDevicePrimaryCtxRelease(HIPDevice));
}

native_type get() const noexcept { return HIPDevice; };
Expand All @@ -60,7 +60,7 @@ struct ur_device_handle_t_ {

int getDeviceMaxLocalMem() const noexcept { return DeviceMaxLocalMem; };

bool getManagedMemSupport() const noexcept { return ManagedMemSupport; };
int getManagedMemSupport() const noexcept { return ManagedMemSupport; };
};

int getAttribute(ur_device_handle_t Device, hipDeviceAttribute_t Attribute);

0 comments on commit 0235cd0

Please sign in to comment.