From 7e8ccfc3c5e51952854ca77e79d4f44a15932a41 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 19 Nov 2014 18:38:13 -0500
Subject: [PATCH] P4 to Git Change 1098843 by mbareghe@mbareghe_staging_win30
on 2014/11/19 18:08:14
EPR #409798 - clCompileProgram and clLinkProgram regression for SPIR - set the correct IR type while extracting from binary (aclSPIR, aclLLVMIR) for single SPIR module for CPU.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#62 edit
[ROCm/clr commit: 57a45f9066d0ea8b6246939a36c2e87c728dd5d1]
---
projects/clr/rocclr/runtime/device/cpu/cpuprogram.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/cpu/cpuprogram.cpp b/projects/clr/rocclr/runtime/device/cpu/cpuprogram.cpp
index 55d4d15c2f..a60af2d77c 100644
--- a/projects/clr/rocclr/runtime/device/cpu/cpuprogram.cpp
+++ b/projects/clr/rocclr/runtime/device/cpu/cpuprogram.cpp
@@ -1066,7 +1066,9 @@ Program::linkImpl(
}
if (libs.size() > 0 && err == ACL_SUCCESS) do {
- if (libs.size() > 1) {
+ unsigned int numLibs = libs.size() - 1;
+ bool resultIsSPIR = (llvmBinaryIsSpir[0] && numLibs == 0);
+ if (numLibs > 0) {
err = aclLink(compiler(), libs[0], libs.size() - 1, &libs[1],
ACL_TYPE_LLVMIR_BINARY, "-create-library", NULL);
@@ -1080,7 +1082,7 @@ Program::linkImpl(
size_t size = 0;
const void* llvmir = aclExtractSection(compiler(), libs[0],
- &size, aclLLVMIR, &err);
+ &size, resultIsSPIR?aclSPIR:aclLLVMIR, &err);
if (err != ACL_SUCCESS) {
LogWarning("aclExtractSection failed");
break;