P4 to Git Change 1423425 by lmoriche@lmoriche_palamida on 2017/06/16 13:49:36
SWDEV-102733 - [OCL-LC-ROCm] Cmake build Write CMakeLists.txt to enable building with and without the DK environment - Update from git. Affected files ... ... //depot/stg/opencl/drivers/opencl/CMakeLists.txt#12 edit ... //depot/stg/opencl/drivers/opencl/cmake/modules/bc2h.cmake#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/CMakeLists.txt#7 edit
Dieser Commit ist enthalten in:
@@ -47,8 +47,6 @@ add_subdirectory(library/amdgcn)
|
||||
|
||||
add_subdirectory(compiler/lib/loaders/elf/utils/libelf)
|
||||
|
||||
add_subdirectory(tools/bc2h)
|
||||
|
||||
find_package(ROCR REQUIRED)
|
||||
add_subdirectory(runtime)
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c
|
||||
"#include <stdio.h>\n"
|
||||
"int main(int argc, char **argv){\n"
|
||||
" FILE *ifp, *ofp;\n"
|
||||
" int c, i, l;\n"
|
||||
" if (argc != 4) return 1;\n"
|
||||
" ifp = fopen(argv[1], \"rb\");\n"
|
||||
" if (!ifp) return 1;\n"
|
||||
" i = fseek(ifp, 0, SEEK_END);\n"
|
||||
" if (i < 0) return 1;\n"
|
||||
" l = ftell(ifp);\n"
|
||||
" if (l < 0) return 1;\n"
|
||||
" i = fseek(ifp, 0, SEEK_SET);\n"
|
||||
" if (i < 0) return 1;\n"
|
||||
" ofp = fopen(argv[2], \"wb+\");\n"
|
||||
" if (!ofp) return 1;\n"
|
||||
" fprintf(ofp, \"#define %s_size %d\\n\\n\"\n"
|
||||
" \"#if defined __GNUC__\\n\"\n"
|
||||
" \"__attribute__((aligned (4096)))\\n\"\n"
|
||||
" \"#elif defined _MSC_VER\\n\"\n"
|
||||
" \"__declspec(align(4096))\\n\"\n"
|
||||
" \"#endif\\n\"\n"
|
||||
" \"static const unsigned char %s[%s_size+1] = {\",\n"
|
||||
" argv[3], l,\n"
|
||||
" argv[3], argv[3]);\n"
|
||||
" i = 0;\n"
|
||||
" while ((c = getc(ifp)) != EOF) {\n"
|
||||
" if (0 == (i&7)) fprintf(ofp, \"\\n \");\n"
|
||||
" fprintf(ofp, \" 0x%02x,\", c);\n"
|
||||
" ++i;\n"
|
||||
" }\n"
|
||||
" fprintf(ofp, \" 0x00\\n};\\n\\n\");\n"
|
||||
" fclose(ifp);\n"
|
||||
" fclose(ofp);\n"
|
||||
" return 0;\n"
|
||||
"}\n"
|
||||
)
|
||||
|
||||
add_executable(bc2h ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c)
|
||||
@@ -1,8 +1,11 @@
|
||||
include(bc2h)
|
||||
|
||||
set(INC_SUFFIX "amdgcn.inc")
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(${ROCM_OCL_INCLUDES})
|
||||
|
||||
add_library(oclrocm OBJECT
|
||||
rocprintf.cpp
|
||||
@@ -30,7 +33,7 @@ foreach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS})
|
||||
set(symbol "${lib_file_name}_amdgcn")
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${header}
|
||||
COMMAND bc2h ${bclib} ${CMAKE_CURRENT_BINARY_DIR}/${header} ${symbol}
|
||||
DEPENDS ${AMDGCN_LIB_TARGET}
|
||||
DEPENDS bc2h ${AMDGCN_LIB_TARGET}
|
||||
COMMENT "Generating ${header}"
|
||||
)
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}.inc)
|
||||
@@ -90,4 +93,4 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.inc
|
||||
)
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.inc ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch)
|
||||
add_custom_target(opencl2.0-c.amdgcn.inc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.inc)
|
||||
add_dependencies(oclrocm opencl2.0-c.amdgcn.inc)
|
||||
add_dependencies(oclrocm opencl2.0-c.amdgcn.inc)
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren