step6, enhance error check, remove CUDA macro, enhance device id to fix none-zero id issue
This commit is contained in:
parent
6dd32789b4
commit
3a9d2c54ba
5 changed files with 258 additions and 190 deletions
|
@ -448,11 +448,11 @@ endif()
|
|||
|
||||
if (LLAMA_SYCL)
|
||||
set(ENABLE_AOT ats)
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang")
|
||||
message(WARNING "Only LLVM is supported for SYCL")
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES "Intel")
|
||||
message(WARNING "${CMAKE_C_COMPILER_ID} Need IntelLLVM for SYCL")
|
||||
endif()
|
||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
message(WARNING "Only LLVM is supported for SYCL")
|
||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
|
||||
message(WARNING "${CMAKE_CXX_COMPILER_ID} Need IntelLLVM for SYCL")
|
||||
endif()
|
||||
|
||||
#find_package(SYCL REQUIRED)
|
||||
|
@ -476,6 +476,7 @@ if (LLAMA_SYCL)
|
|||
add_compile_definitions(GGML_USE_CUBLAS)
|
||||
#add_compile_definitions(GGML_SYCL_F16)
|
||||
#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/sycl)
|
||||
add_compile_options(-I/opt/intel/oneapi/dpcpp-ct/2024.0/include)
|
||||
|
|
420
ggml-sycl.cpp
420
ggml-sycl.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,17 @@
|
|||
#include <sycl/sycl.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
2
run.sh
|
@ -11,7 +11,7 @@ else
|
|||
export GGML_SYCL_DEVICE=0
|
||||
fi
|
||||
echo GGML_SYCL_DEVICE=$GGML_SYCL_DEVICE
|
||||
#export GGML_SYCL_DEBUG=1
|
||||
export GGML_SYCL_DEBUG=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 "${INPUT2}" -n 400 -e -ngl 33
|
||||
|
|
2
setup.sh
2
setup.sh
|
@ -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
|
||||
cmake --build . --config Release -v
|
||||
cmake --build . --config Release --target main
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue