P4 to Git Change 1183928 by yaxunl@yaxunl_stg_win50 on 2015/08/24 13:06:02

ECR #354633 - SPIR-V: Let aoc2 load and save SPIR-V.

	E.g.

	aoc2 -march=hsail-64 -cl-std=CL2.0 -srctospv testReadf.cl
	compile a cl to SPIR-V binary and save it as .spv

	aoc2 -march=hsail-64 -cl-std=CL2.0 -spirv work_group_any.spv
	load a SPIR-V binary and compiles it to ISA and save it to elf in .bin

	Changed the option for round-trip translation of SPIR-V to -round-trip-spirv.

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/acl.cpp#35 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend_clang.cpp#22 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#133 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#74 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#22 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#129 edit
... //depot/stg/opencl/drivers/opencl/compiler/tools/aoc2/aoc2.cpp#76 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#47 edit


[ROCm/clr commit: cc13b9f1f6]
This commit is contained in:
foreman
2015-08-24 13:14:41 -04:00
parent 9612f595da
commit 08bd8f4b3b
5 changed files with 116 additions and 13 deletions
@@ -54,6 +54,7 @@
#include "llvm/AMDPrelink.h"
#endif
#include "llvm/AMDUtils.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Analysis/AMDLocalArrayUsage.h"
@@ -136,14 +137,6 @@ namespace {
using namespace llvm;
#ifdef HAS_SPIRV
// Enable drop-in bi-way translation of LLVM/SPIR-V for testing purpose.
cl::opt<bool> TestSpirv("test-spirv",
cl::desc("Test SPIR-V translation"),
cl::init(false),
cl::Hidden);
#endif
// LoadFile - Read the specified bitcode file in and return it. This routine
// searches the link path for the specified file to try to find it...
//
@@ -608,12 +601,12 @@ amdcl::OCLLinker::link(llvm::Module* input, std::vector<llvm::Module*> &libs)
}
#ifdef HAS_SPIRV
if (amd::TestSpirv) {
if (Options()->oVariables->RoundTripSPIRV && isSPIRModule(*llvmbinary_)) {
std::string DumpSpirv;
std::string DumpLlvm;
if (Options()->isDumpFlagSet(amd::option::DUMP_BC_ORIGINAL)) {
DumpSpirv = Options()->getDumpFileName(".spv");
DumpLlvm = Options()->getDumpFileName("_spirv.bc");
DumpLlvm = Options()->getDumpFileName("_fromspv.bc");
}
translateSpirv(llvmbinary_, DumpSpirv, DumpLlvm);
}