
This PR is to address legacy issues with module analysis that currently uses a complicated and not so efficient approach to trace dependencies between SPIR-V id's via a duplicate tracker data structures and an explicitly built dependency graph. Even a quick performance check without any specialized benchmarks points to this part of the implementation as a biggest bottleneck. This PR specifically: * eliminates a need to build a dependency graph as a data structure, * updates the test suite (mainly, by fixing incorrect CHECK's referring to a hardcoded order of definitions, contradicting the spec requirement to allow certain definitions to go "in any order", see https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_logical_layout_of_a_module), * improves function pointers implementation so that it now passes EXPENSIVE_CHECKS (thus removing 3 XFAIL's in the test suite). As a quick sanity check of whether goals of the PR are achieved, we can measure time of translation for any big LLVM IR. While testing the PR in the local development environment, improvements of the x5 order have been observed. For example, the SYCL test case "group barrier" that is a ~1Mb binary IR input shows the following values of the naive performance metric that we can nevertheless apply here to roughly estimate effects of the PR. before the PR: ``` $ time llc -O0 -mtriple=spirv64v1.6-unknown-unknown _group_barrier_phi.bc -o 1 --filetype=obj real 3m33.241s user 3m14.688s sys 0m18.530s ``` after the PR ``` $ time llc -O0 -mtriple=spirv64v1.6-unknown-unknown _group_barrier_phi.bc -o 1 --filetype=obj real 0m42.031s user 0m38.834s sys 0m3.193s ``` Next work should probably address Duplicate Tracker further, as it needs analysis now from the perspective of what parts of it are not necessary now, after changing the approach to implementation of the module analysis step.
21 lines
717 B
LLVM
21 lines
717 B
LLVM
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
|
|
|
|
; CHECK-DAG: [[uint:%[0-9]+]] = OpTypeInt 32 0
|
|
; CHECK-DAG: [[uint2:%[0-9]+]] = OpTypeVector [[uint]] 2
|
|
; CHECK-DAG: [[uint_1:%[0-9]+]] = OpConstant [[uint]] 1
|
|
; CHECK-DAG: [[ptr_uint:%[0-9]+]] = OpTypePointer Function [[uint]]
|
|
; CHECK-DAG: [[ptr_uint2:%[0-9]+]] = OpTypePointer Function [[uint2]]
|
|
|
|
define void @main() #1 {
|
|
entry:
|
|
%0 = alloca <2 x i32>, align 4
|
|
; CHECK: [[var:%[0-9]+]] = OpVariable [[ptr_uint2]] Function
|
|
|
|
%1 = getelementptr <2 x i32>, ptr %0, i32 0, i32 1
|
|
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_uint]] [[var]] [[uint_1]]
|
|
|
|
ret void
|
|
}
|
|
|
|
attributes #1 = { "hlsl.numthreads"="4,8,16" "hlsl.shader"="compute" }
|