Skip to content

Commit

Permalink
Enable vc lit tests
Browse files Browse the repository at this point in the history
Cmake modifications for VC lit tests
  • Loading branch information
dguzhaev authored and igcbot committed Jun 20, 2023
1 parent cb90788 commit 02f6f54
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 1 deletion.
22 changes: 22 additions & 0 deletions IGC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,21 @@ if(IGC_BUILD__VC_ENABLED)
endif()

if(IGC_BUILD__VC_ENABLED)
# VC LIT tests are unix only but
set(IGC_BUILD__CMLIT_ENABLE_DEFAULT OFF)
if(IGC_OPTION__ENABLE_LIT_TESTS AND LLVM_ON_UNIX)
set(IGC_BUILD__CMLIT_ENABLE_DEFAULT ON)
endif()

set(IGC_BUILD__CMLIT_ENABLE ${IGC_BUILD__CMLIT_ENABLE_DEFAULT} CACHE BOOL "Whether VC lit testing is enabled")
if(IGC_BUILD__CMLIT_ENABLE)
# Path to llvm-opt and llvm lib built with LLVM_LINK_LLVM_DYLIB option
# Required to load vc-be plugin in opt
set(IGC_BUILD__CMOPT_DEFAULT_DIR ${IGC_BUILD__GFX_DEV_SRC_DIR}/../cmc/cm-opt/llvm-${LLVM_VERSION_MAJOR})
set(IGC_BUILD__CMOPT_DIR ${IGC_BUILD__CMOPT_DEFAULT_DIR} CACHE PATH
"Path to opt utility for VC lit testing")
message(STATUS "VC LIT tests enabled. Opt in ${IGC_BUILD__CMOPT_DIR}")
endif()
add_subdirectory(VectorCompiler)
endif()

Expand Down Expand Up @@ -1962,6 +1977,13 @@ if(DEFINED IGC_BUILD__PROJ__igc_opt AND TARGET ${IGC_BUILD__PROJ__igc_opt})
add_subdirectory(Compiler/tests)
endif()

# ============================================ VC LIT TESTS =============================================

# If VC LITs are enabled, we need main target depend from it
if(IGC_BUILD__CMLIT_ENABLE)
add_dependencies("${IGC_BUILD__PROJ__igc_dll}" "check-vc")
endif()


# ======================================================================================================

Expand Down
3 changes: 3 additions & 0 deletions IGC/VectorCompiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ add_subdirectory(lib)
# some components in IGC.
add_subdirectory(igcdeps)

if(IGC_BUILD__CMLIT_ENABLE)
add_subdirectory(test)
endif()

add_subdirectory(utils)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
; RUN: -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-generateDebugInfo -dce 0' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_kernel_dwarf.elf | FileCheck %s

; CHECK: DW_AT_name : arg_2
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/arg_stackcall_vector.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
; RUN: -finalizer-opts='-debug -generateDebugInfo -dumpcommonisa' -o /dev/null
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_kernel_dwarf.elf | FileCheck %s

; REQUIRES: oneapi-readelf
; RUN: FileCheck %s --input-file=kernel_f0.visaasm --check-prefix=CHECK_ARGSIZE

; CHECK_ARGSIZE: .kernel_attr ArgSize=1
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/bale_propagate.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
; RUN: -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_kernel_dwarf.elf | FileCheck %s

; CHECK: (DW_TAG_variable)
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/basic_1K1S_Sub.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
; COM: the kernel should have two intervals corresponding to subroutine
; COM: (since subroutines are copied between kernels and stack-calls)

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_K1_dwarf.elf | FileCheck %s --check-prefix=CHECK_SUBROUTINE
; COM: this matches any subprogram, then search for Subroutine record
; CHECK_SUBROUTINE: DW_TAG_subprogram
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/basic_reloc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
; RUN: -vc-experimental-dbg-info-zebin-compatible \
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf -r dbginfo_%basename_t_test_kernel_dwarf.elf | FileCheck %s

; COM: make sure that the produced file can be consumed by lld
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/basic_var_locs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target triple = "genx64-unknown-unknown"
; RUN: -vc-enable-dbginfo-dumps -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_vector_add_dwarf.elf | FileCheck %s
; RUN: llvm-dwarfdump dbginfo_%basename_t_vector_add_dwarf.elf | FileCheck %s --check-prefix DWARFDUMP

Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/basic_var_locs_small.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target triple = "genx64-unknown-unknown"
; RUN: -vc-enable-dbginfo-dumps -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_vector_add_dwarf.elf | FileCheck %s
; RUN: llvm-dwarfdump dbginfo_%basename_t_vector_add_dwarf.elf | FileCheck %s --check-prefix DWARFDUMP

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
; COM: lo/hi pc associated with it. This issue shoul be investigated once
; COM: problem with stack call is fixed

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_K1_dwarf.elf | FileCheck %s --check-prefix=CHECK_STACK
; CHECK_STACK: DW_TAG_subprogram
; CHECK_STACK: DW_AT_name : S1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
; RUN: -o dbginfo_%basename_t_linked.elf \
; RUN: dbginfo_%basename_t_K1_dwarf.elf dbginfo_%basename_t_K2_dwarf.elf

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf -a dbginfo_%basename_t_linked.elf | FileCheck %s --check-prefix=CHECK_READELF

; CHECK_READELF: Relocation section '.rela.debug_info' at offset 0x{{[0-9a-f]+}} contains {{[0-9]+}} entries
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/select.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
; RUN: -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-debug -generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_kernel_dwarf.elf | FileCheck %s

; CHECK: DW_AT_name : D5
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/var_loc_declare.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
; RUN: -vc-enable-dbginfo-dumps -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-debug -generateDebugInfo' -o /dev/null
;
; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_test_dwarf.elf | FileCheck %s

; CHECK: DW_AT_name : tmp_val
Expand Down
1 change: 1 addition & 0 deletions IGC/VectorCompiler/test/DebugInfo/var_loc_ptr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
; RUN: -vc-enable-dbginfo-dumps -vc-dbginfo-dumps-name-override=%basename_t \
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null

; REQUIRES: oneapi-readelf
; RUN: oneapi-readelf --debug-dump dbginfo_%basename_t_test_dwarf.elf | FileCheck %s

; CHECK: DW_AT_name : buff_address
Expand Down
5 changes: 4 additions & 1 deletion IGC/VectorCompiler/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
tools = [ToolSubst('not'),
ToolSubst('opt', extra_args=vc_extra_args+[config.llvm_dependent_opt_flags]),
ToolSubst('llc', extra_args=vc_extra_args),
ToolSubst('oneapi-readelf'),
ToolSubst('oneapi-readelf', unresolved='ignore'),
ToolSubst('llvm-dwarfdump'),
ToolSubst('%igc-lld', command=FindTool('ld.lld'))]

Expand All @@ -81,4 +81,7 @@
else:
config.available_features.add('llvm_12_or_greater')

if config.oneapi_readelf_dir:
config.available_features.add('oneapi-readelf')

llvm_config.add_tool_substitutions(tools, tool_dirs)

0 comments on commit 02f6f54

Please sign in to comment.