Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,26 @@ if (DNNL_TARGET_ARCH STREQUAL "RV64")
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})

set(CAN_COMPILE_RVV_INTRINSICS TRUE)

# If explicitly passed DNNL_ARCH_OPT_FLAGS without V or Zvfh in the -march
# string, disable their code paths even if the toolchain supports them.
if (DEFINED DNNL_ARCH_OPT_FLAGS AND DNNL_ARCH_OPT_FLAGS MATCHES "-march=")
string(FIND "${DNNL_ARCH_OPT_FLAGS}" "gcv" _dnnl_rv64_v_pos)
string(FIND "${DNNL_ARCH_OPT_FLAGS}" "zvfh" _dnnl_rv64_zvfh_pos)
if (_dnnl_rv64_v_pos EQUAL -1)
set(CAN_COMPILE_RVV_INTRINSICS FALSE)
set(CAN_COMPILE_ZVFH_INTRINSICS FALSE)
elseif (_dnnl_rv64_zvfh_pos EQUAL -1)
set(CAN_COMPILE_ZVFH_INTRINSICS FALSE)
endif()
endif()

if (CAN_COMPILE_ZVFH_INTRINSICS)
set(CAN_COMPILE_ZVFH_INTRINSICS TRUE)
set(RV64_MARCH_FLAG "-march=rv64gcv_zvfh")
else()
set(CAN_COMPILE_ZVFH_INTRINSICS FALSE)
elseif (CAN_COMPILE_RVV_INTRINSICS)
set(RV64_MARCH_FLAG "-march=rv64gcv")
else()
set(RV64_MARCH_FLAG "-march=rv64gc")
endif()
else()
# RVV is not supported, so Zvfh is also not supported
Expand Down
4 changes: 2 additions & 2 deletions src/cpu/rv64/rvv_nhwc_pooling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "common/primitive.hpp"
#include "cpu/cpu_pooling_pd.hpp"
#include "cpu/rv64/cpu_isa_traits.hpp"
#include "cpu/rv64/rvv_postops.hpp"

namespace dnnl {
Expand Down Expand Up @@ -66,8 +67,7 @@ struct riscv_nhwc_pooling_fwd_t : public primitive_t {
VERBOSE_UNSUPPORTED_DT);

if (is_f16) {
VDISPATCH_POOLING(DNNL_RISCV_USE_ZVFH_INTRINSICS,
VERBOSE_UNSUPPORTED_ISA);
VDISPATCH_POOLING(mayiuse(zvfh), VERBOSE_UNSUPPORTED_ISA);

// Fallback to reference if post-ops are requested for f16
if (!attr()->post_ops_.has_default_values())
Expand Down
Loading