Skip to content

Commit a537ec9

Browse files
authored
Merge pull request #683 from hvdijk/refsi-issues
Address several refsi issues.
2 parents 30468bd + 6795829 commit a537ec9

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ Examples are provided to get started, but for more control over the compilation
5656

5757
The oneAPI Construction Kit can be compiled for two reference targets; `host` and `refsi` (`riscv`). In SYCL programming, the host target refers to the system where the SYCL program is compiled and executed, while the refsi (Reference System Implementation) target refers to the target platform for which the program is being developed. The refsi target is a hardware-specific implementation of the SYCL specification, enabling the program to run on a specific target platform. SYCL implementations such as DPC++ provide various refsi targets for CPUs, GPUs, FPGAs, and accelerators, which can be selected during compilation using specific flags and code.
5858

59+
#### Compiling oneAPI Construction Kit for host
60+
5961
To compile oneAPI Construction Kit for the host, please refer to the [developer guide](doc/developer-guide.md#compiling-oneapi-construction-kit).
6062

61-
#### Compiling oneAPI Construction Kit for RISC-V
63+
#### Compiling oneAPI Construction Kit for simulated RISC-V
64+
6265
This target aims to provide a flexible way of communicating with various customer RISC-V targets with different configurations. It supports multiple variants using an abstract class and can configure targets and execute commands. However, the current version has only been tested on an x86_64 host CPU.
6366

67+
This target is not intended for running oneAPI Construction Kit directly on RISC-V hardware. For that, the host target should be used.
68+
6469
The available targets in the current implementation are based on Codeplay's reference architecture, called RefSi, with two variations: `G` and `M1`. The `riscv` target is designed to support the `G` variant, while the `M1` variant has additional features like DMA. More information on `riscv` can be found [here](doc/modules/riscv.rst). To build in-tree, run the following:
6570

6671
```sh

modules/compiler/riscv/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ if (LLVMRISCVCODEGEN)
4646
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
4747
)
4848

49+
if(NOT TARGET compiler-linker-utils)
50+
set(error "compiler-riscv-utils requires compiler-linker-utils")
51+
if(NOT EXISTS "${CA_LLVM_INSTALL_DIR}/lib/cmake/lld/LLDConfig.cmake")
52+
string(APPEND error " which requires liblld")
53+
endif()
54+
message(FATAL_ERROR "${error}")
55+
endif()
4956
target_link_libraries(compiler-riscv-utils PUBLIC
5057
compiler-base
5158
hal_common

modules/mux/targets/riscv/source/kernel.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ cargo::expected<riscv::kernel_s *, mux_result_t> kernel_s::create(
3636
auto *hal_device_info = static_cast<const riscv::hal_device_info_riscv_t *>(
3737
device->hal_device->get_info());
3838

39-
const unsigned real_vscale = hal_device_info->vlen / 64;
40-
auto assert_scalable_supported = [hal_device_info]() {
39+
auto real_vscale = [vlen = hal_device_info->vlen]() {
4140
assert(
42-
hal_device_info->vlen &&
41+
vlen &&
4342
"vlen must be known at runtime to calculate scalable subgroup width");
43+
return vlen / 64;
4444
};
4545

4646
cargo::small_vector<mux::hal::kernel_variant_s, 4> variants;
@@ -52,18 +52,15 @@ cargo::expected<riscv::kernel_s *, mux_result_t> kernel_s::create(
5252
variant.variant_name = meta.kernel_name;
5353
variant.sub_group_size = meta.sub_group_size.getKnownMinValue();
5454
if (meta.sub_group_size.isScalable()) {
55-
assert_scalable_supported();
56-
variant.sub_group_size *= real_vscale;
55+
variant.sub_group_size *= real_vscale();
5756
}
5857
variant.min_work_width = meta.min_work_item_factor.getKnownMinValue();
5958
if (meta.min_work_item_factor.isScalable()) {
60-
assert_scalable_supported();
61-
variant.min_work_width *= real_vscale;
59+
variant.min_work_width *= real_vscale();
6260
}
6361
variant.pref_work_width = meta.pref_work_item_factor.getKnownMinValue();
6462
if (meta.pref_work_item_factor.isScalable()) {
65-
assert_scalable_supported();
66-
variant.pref_work_width *= real_vscale;
63+
variant.pref_work_width *= real_vscale();
6764
}
6865
if (cargo::success != variants.push_back(std::move(variant))) {
6966
return cargo::make_unexpected(mux_error_out_of_memory);

0 commit comments

Comments
 (0)