diff --git a/projects/clr/rocclr/device/rocm/rocblit.hpp b/projects/clr/rocclr/device/rocm/rocblit.hpp index d7c6421025..1d9d0e670d 100644 --- a/projects/clr/rocclr/device/rocm/rocblit.hpp +++ b/projects/clr/rocclr/device/rocm/rocblit.hpp @@ -619,9 +619,10 @@ inline void KernelBlitManager::setArgument(amd::Kernel* kernel, size_t index, reinterpret_cast(kernel->parameters().values() + kernel->parameters().memoryObjOffset())[desc.info_.arrayIndex_] = nullptr; } else { - // convert cl_mem to amd::Memory*, return false if invalid. - amd::Memory* mem = as_amd(*static_cast(value)); if (!writeVAImmediate) { + // convert cl_mem to amd::Memory*, return false if invalid. + amd::Memory* mem = as_amd(*static_cast(value)); + reinterpret_cast(kernel->parameters().values() + kernel->parameters().memoryObjOffset())[desc.info_.arrayIndex_] = mem; if (dev_mem == nullptr) {