step6, enhance error check, remove CUDA macro, enhance device id to fix none-zero id issue

This commit is contained in:
jianyuzh 2024-01-04 14:26:36 +08:00 committed by Meng, Hengyu
parent 6dd32789b4
commit 3a9d2c54ba
5 changed files with 258 additions and 190 deletions

View file

@ -448,11 +448,11 @@ endif()
if (LLAMA_SYCL) if (LLAMA_SYCL)
set(ENABLE_AOT ats) set(ENABLE_AOT ats)
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang") if (NOT ${CMAKE_C_COMPILER_ID} MATCHES "Intel")
message(WARNING "Only LLVM is supported for SYCL") message(WARNING "${CMAKE_C_COMPILER_ID} Need IntelLLVM for SYCL")
endif() endif()
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
message(WARNING "Only LLVM is supported for SYCL") message(WARNING "${CMAKE_CXX_COMPILER_ID} Need IntelLLVM for SYCL")
endif() endif()
#find_package(SYCL REQUIRED) #find_package(SYCL REQUIRED)
@ -476,6 +476,7 @@ if (LLAMA_SYCL)
add_compile_definitions(GGML_USE_CUBLAS) add_compile_definitions(GGML_USE_CUBLAS)
#add_compile_definitions(GGML_SYCL_F16) #add_compile_definitions(GGML_SYCL_F16)
#add_compile_options(-std=c++17 -O3 -fsycl) #add_compile_options(-std=c++17 -O3 -fsycl)
add_compile_options(-I./)
add_compile_options(-I/opt/intel/oneapi/compiler/2024.0/include) add_compile_options(-I/opt/intel/oneapi/compiler/2024.0/include)
add_compile_options(-I/opt/intel/oneapi/compiler/2024.0/include/sycl) add_compile_options(-I/opt/intel/oneapi/compiler/2024.0/include/sycl)
add_compile_options(-I/opt/intel/oneapi/dpcpp-ct/2024.0/include) add_compile_options(-I/opt/intel/oneapi/dpcpp-ct/2024.0/include)

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,17 @@
#include <sycl/sycl.hpp> #include <sycl/sycl.hpp>
#include <dpct/dpct.hpp> #include <dpct/dpct.hpp>
typedef half ggml_fp16_t; // typedef sycl::half ggml_fp16_t;
#define CHECK_TRY_ERROR(expr) \
[&]() { \
try { \
expr; \
return dpct::success; \
} catch (std::exception const &e) { \
std::cerr << e.what()<< "\nException caught at file:" << __FILE__ \
<< ", line:" << __LINE__ <<", func:"<<__func__<< std::endl; \
return dpct::default_error; \
} \
}()
#define DEBUG_CUDA_MALLOC

2
run.sh
View file

@ -11,7 +11,7 @@ else
export GGML_SYCL_DEVICE=0 export GGML_SYCL_DEVICE=0
fi fi
echo GGML_SYCL_DEVICE=$GGML_SYCL_DEVICE echo GGML_SYCL_DEVICE=$GGML_SYCL_DEVICE
#export GGML_SYCL_DEBUG=1 export GGML_SYCL_DEBUG=1
#export GGML_SYCL_LIST_DEVICE=1 #export GGML_SYCL_LIST_DEVICE=1
#./build/bin/main -m models/llama-2-7b.Q4_0.gguf -p "${INPUT1}" -e -n 400 -ngl 33 -c 2048 #./build/bin/main -m models/llama-2-7b.Q4_0.gguf -p "${INPUT1}" -e -n 400 -ngl 33 -c 2048
./build/bin/main -m models/llama-2-7b.Q4_0.gguf -p "${INPUT2}" -n 400 -e -ngl 33 ./build/bin/main -m models/llama-2-7b.Q4_0.gguf -p "${INPUT2}" -n 400 -e -ngl 33

View file

@ -6,4 +6,4 @@ source /opt/intel/oneapi/setvars.sh
#cmake .. -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL_F16=ON #cmake .. -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL_F16=ON
cmake .. -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx cmake .. -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
cmake --build . --config Release -v cmake --build . --config Release --target main