Commit 6ab58fbf authored by Shucai Xiao's avatar Shucai Xiao
Browse files

changes to fix unit test errors

parent 74a96965
...@@ -46,7 +46,7 @@ void* get_device_ptr(void* hptr) ...@@ -46,7 +46,7 @@ void* get_device_ptr(void* hptr)
return result; return result;
} }
hip_ptr allocate_gpu(int sz, bool host = false) hip_ptr allocate_gpu(std::size_t sz, bool host = false)
{ {
if(sz > get_available_gpu_memory()) if(sz > get_available_gpu_memory())
MIGRAPHX_THROW("Memory not available to allocate buffer: " + std::to_string(sz)); MIGRAPHX_THROW("Memory not available to allocate buffer: " + std::to_string(sz));
...@@ -62,7 +62,7 @@ hip_ptr allocate_gpu(int sz, bool host = false) ...@@ -62,7 +62,7 @@ hip_ptr allocate_gpu(int sz, bool host = false)
return hip_ptr{result}; return hip_ptr{result};
} }
hip_host_ptr register_on_gpu(void* ptr, int sz) hip_host_ptr register_on_gpu(void* ptr, std::size_t sz)
{ {
auto status = hipHostRegister(ptr, sz, hipHostRegisterMapped); auto status = hipHostRegister(ptr, sz, hipHostRegisterMapped);
if(status != hipSuccess) if(status != hipSuccess)
...@@ -71,7 +71,7 @@ hip_host_ptr register_on_gpu(void* ptr, int sz) ...@@ -71,7 +71,7 @@ hip_host_ptr register_on_gpu(void* ptr, int sz)
} }
template <class T> template <class T>
std::vector<T> read_from_gpu(const void* x, int sz) std::vector<T> read_from_gpu(const void* x, std::size_t sz)
{ {
gpu_sync(); gpu_sync();
std::vector<T> result(sz); std::vector<T> result(sz);
...@@ -81,7 +81,7 @@ std::vector<T> read_from_gpu(const void* x, int sz) ...@@ -81,7 +81,7 @@ std::vector<T> read_from_gpu(const void* x, int sz)
return result; return result;
} }
hip_ptr write_to_gpu(const void* x, int sz, bool host = false) hip_ptr write_to_gpu(const void* x, std::size_t sz, bool host = false)
{ {
gpu_sync(); gpu_sync();
auto result = allocate_gpu(sz, host); auto result = allocate_gpu(sz, host);
......
...@@ -12,7 +12,7 @@ extern hipError_t hipExtModuleLaunchKernel(hipFunction_t, // NOLINT ...@@ -12,7 +12,7 @@ extern hipError_t hipExtModuleLaunchKernel(hipFunction_t, // NOLINT
uint32_t, uint32_t,
uint32_t, uint32_t,
uint32_t, uint32_t,
int, size_t,
hipStream_t, hipStream_t,
void**, void**,
void**, void**,
......
...@@ -132,7 +132,7 @@ __device__ void roialign(const T& x_t, const U& rois_t, const V& ind_t, const W& ...@@ -132,7 +132,7 @@ __device__ void roialign(const T& x_t, const U& rois_t, const V& ind_t, const W&
auto channel_num = x_lens[1]; auto channel_num = x_lens[1];
// input dims of height and width, in all 2-dim arrays, the first dim // input dims of height and width, in all 2-dim arrays, the first dim
// is for height and second dim is for width // is for height and second dim is for width
array<int, 2> in_dims = {x_lens[2], x_lens[3]}; array<int, 2> in_dims = {static_cast<int>(x_lens[2]), static_cast<int>(x_lens[3])};
const auto stride = index.nglobal(); const auto stride = index.nglobal();
auto out_s = y_t.get_shape(); auto out_s = y_t.get_shape();
...@@ -141,7 +141,7 @@ __device__ void roialign(const T& x_t, const U& rois_t, const V& ind_t, const W& ...@@ -141,7 +141,7 @@ __device__ void roialign(const T& x_t, const U& rois_t, const V& ind_t, const W&
// output dims of height and width, in all 2-dim arrays, the first dim // output dims of height and width, in all 2-dim arrays, the first dim
// is for height and second dim is for width // is for height and second dim is for width
const auto& out_lens = out_s.lens; const auto& out_lens = out_s.lens;
array<int, 2> out_dims = {out_lens[2], out_lens[3]}; array<int, 2> out_dims = {static_cast<int>(out_lens[2]), static_cast<int>(out_lens[3])};
for(index_int i = index.global; i < out_s.elements(); i += stride) for(index_int i = index.global; i < out_s.elements(); i += stride)
{ {
......
...@@ -3586,7 +3586,7 @@ TEST_CASE(resize_downsample_linear_test) ...@@ -3586,7 +3586,7 @@ TEST_CASE(resize_downsample_linear_test)
EXPECT(p == prog); EXPECT(p == prog);
} }
TEST_CASE(resize_outintest) TEST_CASE(resize_outsize_test)
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
...@@ -3608,7 +3608,7 @@ TEST_CASE(resize_outintest) ...@@ -3608,7 +3608,7 @@ TEST_CASE(resize_outintest)
auto r = mm->add_instruction(migraphx::make_op("gather", {{"axis", 0}}), lrsp, li); auto r = mm->add_instruction(migraphx::make_op("gather", {{"axis", 0}}), lrsp, li);
mm->add_return({r}); mm->add_return({r});
auto prog = migraphx::parse_onnx("resize_outintest.onnx"); auto prog = migraphx::parse_onnx("resize_outsize_test.onnx");
EXPECT(p == prog); EXPECT(p == prog);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment