From b8b14641fc123bf8a8bff34492826b5c0ef94d5f Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 25 Apr 2016 18:43:12 -0400
Subject: [PATCH] P4 to Git Change 1261645 by smekhano@stas-nova-hsa on
2016/04/25 18:33:13
SWDEV-92625 - x86 RT: fix division by zero in cpumapping::HCtoDCmap
In many cases default alignment passed as 0. At the same time minimal possible alignment is 1,
while cpumappings uses this value as a divisor. Set it to max(passed alignment, 1).
Testing: smoke, precheckin, conformance really quick on cpu
Reviewed by German Andreev
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.cpp#5 edit
[ROCm/clr commit: 62a98d8da8570c695667dc70a62595b627a4f018]
---
projects/clr/rocclr/runtime/device/cpu/cpumapping.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/projects/clr/rocclr/runtime/device/cpu/cpumapping.cpp b/projects/clr/rocclr/runtime/device/cpu/cpumapping.cpp
index 1d46f355b9..3ef0572635 100644
--- a/projects/clr/rocclr/runtime/device/cpu/cpumapping.cpp
+++ b/projects/clr/rocclr/runtime/device/cpu/cpumapping.cpp
@@ -27,6 +27,7 @@ using std::max;
namespace cpu {
HCtoDCmap::HCtoDCmap(const clk_parameter_descriptor_t* desc, unsigned int level_alignment, unsigned int index, unsigned int init_offset)
{
+ level_alignment = std::max(level_alignment, 1u); // Minimal possible alignment is 1 and alignment is used as a divisor below.
//Initialize fields
hc_offset = 0;
hc_size = 0;