Skip to content

Commit

Permalink
initial update
Browse files Browse the repository at this point in the history
  • Loading branch information
tinebp committed May 14, 2024
1 parent 0bffce0 commit c2675cd
Show file tree
Hide file tree
Showing 7 changed files with 1,253 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ option(POCL_DEBUG_MESSAGES

option(ENABLE_LOADABLE_DRIVERS "Enable drivers to be dlopen()-ed at pocl runtime, instead of being linked into libpocl" ON)

option(ENABLE_VORTEX "Enable the Vortex OpenGPU device driver" OFF)

option(ENABLE_HSA "Enable the HSA base profile runtime device driver" OFF)

option(ENABLE_CUDA "Enable the CUDA device driver for NVIDIA devices" OFF)
Expand Down Expand Up @@ -1722,6 +1724,22 @@ endif()

##########################################################

if(ENABLE_VORTEX)

if(NOT "${LLVM_ALL_TARGETS}" MATCHES "RISCV")
message(FATAL_ERROR "Vortex build requested but LLVM does not support RISCV target!")
endif()

set(OCL_DRIVERS "${OCL_DRIVERS} vortex")
set(OCL_TARGETS "${OCL_TARGETS} vortex")
# this is for config.h
# TODO unify with autotools
set(BUILD_VORTEX 1)

endif()

##########################################################

if(ENABLE_CUDA)

if(NOT "${LLVM_ALL_TARGETS}" MATCHES "NVPTX")
Expand Down Expand Up @@ -2274,6 +2292,7 @@ MESSAGE(STATUS "ENABLE_TCE: ${ENABLE_TCE}")
MESSAGE(STATUS "ENABLE_TCEMC: ${ENABLE_TCEMC}")
MESSAGE(STATUS "ENABLE_HSA: ${ENABLE_HSA}")
MESSAGE(STATUS "ENABLE_ALMAIF_DEVICE: ${ENABLE_ALMAIF_DEVICE}")
MESSAGE(STATUS "ENABLE_VORTEX: ${ENABLE_VORTEX}")
MESSAGE(STATUS "ENABLE_CUDA: ${ENABLE_CUDA}")
MESSAGE(STATUS "ENABLE_CUDNN: ${ENABLE_CUDNN}")
MESSAGE(STATUS "ENABLE_HOST_CPU_DEVICES: ${ENABLE_HOST_CPU_DEVICES}")
Expand Down
19 changes: 19 additions & 0 deletions README.vortex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// build instructions
$ export TOOLDIR=$HOME/tools
$ export POCL_PATH=$TOOLDIR/pocl2
$ export LLVM_VORTEX=$TOOLDIR/llvm-vortex
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$POCL_PATH -DWITH_LLVM_CONFIG=$LLVM_VORTEX/bin/llvm-config -DENABLE_VORTEX=ON -DBUILD_TESTS=OFF -DPOCL_DEBUG_MESSAGES=ON -DENABLE_ICD=OFF -DCLANG_MARCH_FLAG:STRING=-mcpu= ..
60 changes: 60 additions & 0 deletions lib/CL/devices/vortex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#=============================================================================
# CMake build system files
#
# Copyright (c) 2014-2021 pocl developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#=============================================================================


#add_library("pocl-devices-vortex" OBJECT pocl-vortex.h pocl-vortex.cc)
#if(ENABLE_LOADABLE_DRIVERS)
# target_link_libraries(pocl-devices-vortex PRIVATE ${VORTEX_DRIVER_LIB})
#endif()
#harden("pocl-devices-vortex")
#if(OCL_ICD_INCLUDE_DIRS)
# target_include_directories("pocl-devices-vortex" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
#endif()

#if(MSVC)
# set_source_files_properties( pocl-vortex.h pocl-vortex.cc PROPERTIES LANGUAGE CXX )
#endif(MSVC)


#add_compile_options("-rdynamic")

add_pocl_device_library("pocl-devices-vortex" pocl-vortex.h pocl-vortex.c)
target_compile_options(pocl-devices-vortex PRIVATE "-Wl,--export-dynamic")
if(ENABLE_LOADABLE_DRIVERS)
if(NOT OCS_AVAILABLE)
target_link_libraries(pocl-devices-vortex PRIVATE ${VORTEX_DRIVER_LIB})
message(STATUS "link lib ${VORTEX_DRIVER_LIB}")
endif()
target_link_libraries(pocl-devices-vortex PRIVATE pocl-devices-topology)
endif()

if(OCS_AVAILABLE)
target_compile_definitions(pocl-devices-vortex PRIVATE -D OCS_AVAILABLE)
endif()

if(MSVC)
set_source_files_properties( pocl-vortex.h pocl-vortex.c PROPERTIES LANGUAGE CXX )
endif(MSVC)

Loading

0 comments on commit c2675cd

Please sign in to comment.