Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel
Commits
b5be51ed
Commit
b5be51ed
authored
Jun 15, 2023
by
carlushuang
Browse files
throw exception if have empty pointer
parent
784ef1d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
library/src/utility/device_memory.cpp
library/src/utility/device_memory.cpp
+8
-0
No files found.
library/src/utility/device_memory.cpp
View file @
b5be51ed
...
@@ -31,6 +31,10 @@ void DeviceMem::ToDevice(const void* p) const
...
@@ -31,6 +31,10 @@ void DeviceMem::ToDevice(const void* p) const
hip_check_error
(
hip_check_error
(
hipMemcpy
(
mpDeviceBuf
,
const_cast
<
void
*>
(
p
),
mMemSize
,
hipMemcpyHostToDevice
));
hipMemcpy
(
mpDeviceBuf
,
const_cast
<
void
*>
(
p
),
mMemSize
,
hipMemcpyHostToDevice
));
}
}
else
{
throw
std
::
runtime_error
(
"ToDevice with an empty pointer"
);
}
}
}
void
DeviceMem
::
FromDevice
(
void
*
p
)
const
void
DeviceMem
::
FromDevice
(
void
*
p
)
const
...
@@ -39,6 +43,10 @@ void DeviceMem::FromDevice(void* p) const
...
@@ -39,6 +43,10 @@ void DeviceMem::FromDevice(void* p) const
{
{
hip_check_error
(
hipMemcpy
(
p
,
mpDeviceBuf
,
mMemSize
,
hipMemcpyDeviceToHost
));
hip_check_error
(
hipMemcpy
(
p
,
mpDeviceBuf
,
mMemSize
,
hipMemcpyDeviceToHost
));
}
}
else
{
throw
std
::
runtime_error
(
"FromDevice with an empty pointer"
);
}
}
}
void
DeviceMem
::
SetZero
()
const
void
DeviceMem
::
SetZero
()
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment