Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Removing all ComputeCpp occurences (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-Nick authored Jun 5, 2024
1 parent 1586b7e commit b2b084c
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 1,787 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ local.properties
.springBeans

# CMake generated files
tools/computecpp_info/common_device_compiler_flags.h
build/

# Doxygen
Expand Down
11 changes: 0 additions & 11 deletions .scripts/build_computecpp.sh

This file was deleted.

17 changes: 2 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ set(PORTBLAS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(PORTBLAS_SRC_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/python_generator)
list(APPEND THIRD_PARTIES_INCLUDE ${CBLAS_INCLUDE})

if(IMGDNN_DIR)
add_definitions(-DIMGDNN_LIBRARY)
find_package(IMGDNN REQUIRED)
list(APPEND THIRD_PARTIES_INCLUDE ${IMGDNN_INCLUDE_DIRS})
endif()

option(BLAS_ENABLE_EXTENSIONS "Whether to enable portBLAS extensions" ON)
option(BLAS_ENABLE_COMPLEX "Whether to enable complex data type for GEMM" OFF)
option(BLAS_ENABLE_HALF "Whether to enable sycl::half data type for supported operators" OFF)
Expand Down Expand Up @@ -183,26 +177,19 @@ else()
# The portblas target is just a collection of other objects so
# the linked libraries are not going to be propagated to this target.
# This requires manual linking against SYCL on Windows.
if(is_computecpp)
target_link_libraries(portblas PUBLIC ComputeCpp::ComputeCpp)
elseif(is_dpcpp)
if(is_dpcpp)
target_link_libraries(portblas PUBLIC DPCPP::DPCPP)
elseif(is_adaptivecpp)
target_link_libraries(portblas PUBLIC AdaptiveCpp::acpp-rt)
endif()
endif()
if(is_computecpp)
set(sycl_impl ComputeCpp::ComputeCpp)
elseif(is_dpcpp)
if(is_dpcpp)
set(sycl_impl DPCPP::DPCPP)
add_sycl_to_target(TARGET portblas SOURCES)
elseif(is_adaptivecpp)
set(sycl_impl AdaptiveCpp::acpp-rt)
add_sycl_to_target(TARGET portblas SOURCES)
endif()
if(IMGDNN_DIR)
target_link_libraries(portblas PUBLIC IMGDNN::IMGDNN)
endif()
set_target_properties(portblas PROPERTIES
INTERFACE_LINK_LIBRARIES ${sycl_impl}
INTERFACE_INCLUDE_DIRECTORIES "${PORTBLAS_INCLUDE}"
Expand Down
56 changes: 1 addition & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ the project.
- [Instaling portBLAS](#instaling-portBLAS)
- [Doxygen](#doxygen)
- [CMake options](#cmake-options)
- [ComputeCpp Compilation (Deprecated)](#computecpp-deprecated)
- [Compile with ComputeCpp](#compile-with-computecpp)
- [POWER\_VR support](#power_vr-support-computecpp-only)
- [Cross-Compile](#cross-compile-computecpp-only)
- [Tests and benchmarks](#tests-and-benchmarks)
- [Contributing to the project](#contributing-to-the-project)
- [Guides and Other Documents](#guides-and-other-documents)
Expand Down Expand Up @@ -493,7 +489,7 @@ Some of the supported options are:
|---|---|---|
| `BLAS_ENABLE_TESTING` | `ON`/`OFF` | Set it to `OFF` to avoid building the tests (`ON` is the default value) |
| `BLAS_ENABLE_BENCHMARK` | `ON`/`OFF` | Set it to `OFF` to avoid building the benchmarks (`ON` is the default value) |
| `SYCL_COMPILER` | name | Used to determine which SYCL implementation to use. By default, the first implementation found is used. Supported values are: `dpcpp`, `adaptivecpp` and `computecpp`*(deprecated)*. |
| `SYCL_COMPILER` | name | Used to determine which SYCL implementation to use. By default, the first implementation found is used. Supported values are: `dpcpp` and `adaptivecpp`. |
| `TUNING_TARGET` | name | By default, this flag is set to `DEFAULT` to restrict any device specific compiler optimizations. Use this flag to tune the code for a target (**highly recommended** for performance). The supported targets are: `INTEL_GPU`, `NVIDIA_GPU`, `AMD_GPU` |
| `CMAKE_PREFIX_PATH` | path | List of paths to check when searching for dependencies |
| `CMAKE_INSTALL_PREFIX` | path | Specify the install location, used when invoking `ninja install` |
Expand All @@ -509,56 +505,6 @@ Some of the supported options are:
| `BLAS_ENABLE_HALF` | `ON`/`OFF` | Determines whether to enable Half data type support *(Support is limited to some Level 1 operators and Gemm)* (`OFF` by default) |
| `BLAS_INDEX_TYPES` | `int32_t;int64_t` | Determines the type(s) to use for `index_t` and `increment_t`. Default is `int` |

## ComputeCpp Compilation *(Deprecated)*

portBLAS ComputeCpp compilation is deprecated since ComputeCpp releasing has been
discontinued. More information about this are found in this [announcement](https://codeplay.com/portal/news/2023/07/07/the-future-of-computecpp).

### Compile with ComputeCpp

```bash
cd build
cmake -GNinja ../ -DComputeCpp_DIR=/path/to/computecpp -DSYCL_COMPILER=computecpp
ninja
```

### Cross-Compile *(ComputeCpp Only)*

To cross-compile portBLAS first the following environment variables must be
set:

```bash
export COMPUTECPP_TOOLCHAIN_DIR="PATH TO TOOLCHAIN_DIR"
export COMPUTECPP_TARGET_TRIPLE="PATH TO TARGET_TRIPLE"
export COMPUTECPP_SYSROOT_DIR="$PATH TO SYSROOT_DIR"
```

Clone the [ComputeCpp-SDK](https://github.com/codeplaysoftware/computecpp-sdk) to retrieve the toolchain file.
The following CMake command can be used to cross-compile portBLAS:

```bash
cmake -GNinja \
${SOURCE_ROOT} \
-DCMAKE_PREFIX_PATH="${OPENBLAS_PATH}" \
-DComputeCpp_DIR="${COMPUTECPP_DEVICE_PATH}" \
-DComputeCpp_HOST_DIR="${COMPUTECPP_X86_PATH}" \
-DCMAKE_TOOLCHAIN_FILE="/path/to/computecpp-sdk/cmake/toolchains/gcc-generic.cmake" \
-DCMAKE_BUILD_TYPE='Release' \
-DCMAKE_INSTALL_PREFIX=${CROSS_COMPILED_PORTBLAS_INSTALL} \
-DOpenCL_INCLUDE_DIR="${OpenCL_Headers_PATH}" \
-DOpenCL_LIBRARY="${OpenCL_LIBRARY}" \
-DCOMPUTECPP_BITCODE="${DEVICE_BITCODE}" \
-DCMAKE_CXX_FLAGS='-O3' \
-DTUNING_TARGET="${CHOSEN_TARGET}"
```

### POWER_VR support *(ComputeCpp Only)*

To enable the PowerVR target tuning, pass: `-DTUNING_TARGET=POWER_VR`

To use the neural network library from Imagination, pass: `-DIMGDNN_DIR=path/to/library`


## Tests and benchmarks

The tests and benchmarks have their own documentation:
Expand Down
29 changes: 1 addition & 28 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,7 @@ add_custom_command(OUTPUT git_config.h
${CMAKE_CURRENT_BINARY_DIR}
)

# Assume ComputeCpp not available by default.
set(ComputeCpp_INFO_AVAILABLE false)
set(ComputeCpp_VERSION_NUMBER "N/A")
set(ComputeCpp_EDITION "N/A")

if(is_computecpp)
execute_process(COMMAND ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE} "--version"
OUTPUT_VARIABLE ComputeCpp_DEVICE_COMPILER_VERSION
RESULT_VARIABLE ComputeCpp_DEVICE_COMPILER_EXECUTABLE_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ComputeCpp_DEVICE_COMPILER_EXECUTABLE_RESULT EQUAL "0")
message(WARNING "Compute++ not found - Error obtaining device compiler and ComputeCpp version!")
else()
# Store information about ComputeCpp/compiler for benchmarking.
set(ComputeCpp_INFO_AVAILABLE true)
string(REGEX MATCH
"(CE|PE|RC)" ComputeCpp_EDITION ${ComputeCpp_DEVICE_COMPILER_VERSION})
if(${ComputeCpp_EDITION} STREQUAL "RC")
set(ComputeCpp_EDITION "Internal")
endif()
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)"
ComputeCpp_VERSION_NUMBER ${ComputeCpp_DEVICE_COMPILER_VERSION})
endif()
endif()

configure_file(computecpp_version_config.h.in computecpp_version_config.h @ONLY)

add_library(bench_info STATIC bench_info.cc git_config.h computecpp_version_config.h)
add_library(bench_info STATIC bench_info.cc git_config.h)
target_include_directories(bench_info PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

if(VERBOSE)
Expand Down
1 change: 0 additions & 1 deletion benchmark/bench_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
* @filename bench_info.cc
*
**************************************************************************/
#include "computecpp_version_config.h"
#include "git_config.h"
34 changes: 0 additions & 34 deletions benchmark/computecpp_version_config.h.in

This file was deleted.

29 changes: 1 addition & 28 deletions cmake/CmakeFunctionHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ function(set_target_compile_def in_target)
target_compile_definitions(${in_target} PUBLIC INTEL_GPU=1)
elseif(${TUNING_TARGET} STREQUAL "AMD_GPU")
target_compile_definitions(${in_target} PUBLIC AMD_GPU=1)
elseif(${TUNING_TARGET} STREQUAL "POWER_VR")
target_compile_definitions(${in_target} PUBLIC POWER_VR=1)
elseif(${TUNING_TARGET} STREQUAL "NVIDIA_GPU")
target_compile_definitions(${in_target} PUBLIC NVIDIA_GPU=1)
else()
Expand Down Expand Up @@ -501,31 +499,6 @@ if(${TUNING_TARGET} STREQUAL "INTEL_GPU")
endif()
endforeach()
endif() # BLAS_ENABLE_COMPLEX
elseif(${TUNING_TARGET} STREQUAL "POWER_VR" AND NOT IMGDNN_DIR)
set(supported_types
"float"
"half"
)
foreach(data ${supported_types})
add_gemm_configuration(
"${data}" 96 "true" "false" "false"
16 4 6 12 8 1 1 1 1 1 1 1 1 1 float float "local" "standard" "full" 1 "strided" "false")
add_gemm_configuration(
"${data}" 64 "false" "false" "false"
128 1 1 8 8 1 1 1 1 1 1 1 1 1 float float "local" "standard" "full" 1 "strided" "false")
add_gemm_configuration(
"${data}" 64 "false" "false" "false"
64 4 4 8 8 1 1 1 1 1 1 1 1 1 float float "no_local" "standard" "full" 1 "strided" "false")
add_gemm_configuration(
"${data}" 128 "false" "false" "false"
16 4 8 16 8 1 1 1 1 1 1 1 1 1 float float "local" "standard" "full" 1 "strided" "false")
add_gemm_configuration(
"${data}" 64 "false" "false" "false"
32 4 4 8 8 1 1 1 1 1 1 1 1 1 float float "local" "standard" "full" 1 "strided" "false")
add_gemm_configuration(
"${data}" 64 "false" "false" "false"
64 4 4 4 4 1 1 1 1 4 4 1 1 1 float float "no_local" "standard" "full" 4 "interleaved" "false")
endforeach()
elseif(${TUNING_TARGET} STREQUAL "AMD_GPU") # need investigation
set(supported_types
"float"
Expand Down Expand Up @@ -749,7 +722,7 @@ else() # default cpu backend
endif()
add_library(${func} OBJECT ${gemm_sources})
set_target_compile_def(${func})
# The blas library depends on FindComputeCpp

target_include_directories(${func} PRIVATE ${PORTBLAS_SRC} ${PORTBLAS_INCLUDE}
${PORTBLAS_COMMON_INCLUDE_DIR} ${THIRD_PARTIES_INCLUDE})
message(STATUS "Adding SYCL to target ${func}")
Expand Down
Loading

0 comments on commit b2b084c

Please sign in to comment.