From 9f63d8a9bf56846b14a7aa75a765257374e0d91a Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 18 Jun 2019 18:03:24 -0400
Subject: [PATCH] P4 to Git Change 1861672 by
vsytchen@vsytchen-remote-ocl-win10 on 2019/06/18 17:53:59
SWDEV-79445 - OCL generic changes and code clean-up
1. Don't modify user passed arguments that should be constant. This saves sanity when debugging.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/17567/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#52 edit
[ROCm/clr commit: 505dd1988f357c172465907f34084210330fbdaa]
---
.../opencl/api/opencl/amdocl/cl_program.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
index 7bd772a8f9..0ce55dbcc7 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_program.cpp
@@ -493,12 +493,12 @@ RUNTIME_ENTRY(cl_int, clBuildProgram,
}
std::vector devices(num_devices);
- while (num_devices--) {
- amd::Device* device = as_amd(*device_list++);
+ for (cl_uint i = 0; i < num_devices; ++i) {
+ amd::Device* device = as_amd(device_list[i]);
if (!amdProgram->context().containsDevice(device)) {
return CL_INVALID_DEVICE;
}
- devices[num_devices] = device;
+ devices[i] = device;
}
return amdProgram->build(devices, options, pfn_notify, user_data);
}
@@ -627,12 +627,12 @@ RUNTIME_ENTRY(cl_int, clCompileProgram,
std::vector devices(num_devices);
- while (num_devices--) {
- amd::Device* device = as_amd(*device_list++);
+ for (cl_uint i = 0; i < num_devices; ++i) {
+ amd::Device* device = as_amd(device_list[i]);
if (!amdProgram->context().containsDevice(device)) {
return CL_INVALID_DEVICE;
}
- devices[num_devices] = device;
+ devices[i] = device;
}
return amdProgram->compile(devices, num_input_headers, headerPrograms, header_include_names,
@@ -781,14 +781,14 @@ RUNTIME_ENTRY_RET(cl_program, clLinkProgram,
} else {
std::vector devices(num_devices);
- while (num_devices--) {
- amd::Device* device = as_amd(*device_list++);
+ for (cl_uint i = 0; i < num_devices; ++i) {
+ amd::Device* device = as_amd(device_list[i]);
if (!as_amd(context)->containsDevice(device)) {
program->release();
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return (cl_program)0;
}
- devices[num_devices] = device;
+ devices[i] = device;
}
status =