Skip to content

Commit

Permalink
[lit] Simplify regex for dxil version check. (microsoft#6335)
Browse files Browse the repository at this point in the history
Check dxc version and dxil version separately.
  • Loading branch information
python3kgae authored Feb 21, 2024
1 parent 16d43a5 commit 5e658ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/clang/test/LitDXILValidation/illegalDXILOp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define void @main() {

%6 = call %dx.types.Handle @dx.op.annotateHandle2(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 32782, i32 0 }) ; AnnotateHandle(res,props) resource: SamplerComparisonState

; CHECK: error: DXILOpCode must be [0..258]. 1999981 specified.
; CHECK: error: DXILOpCode must be [0..{{[0-9]+}}]. 1999981 specified.
; CHECK: note: at '%7 = call float @dx.op.calculateLOD.f32(i32 1999981, %dx.types.Handle %5, %dx.types.Handle %6, float %3, float %4, float undef, i1 true)' in block '#0' of function 'main'.

%7 = call float @dx.op.calculateLOD.f32(i32 1999981, %dx.types.Handle %5, %dx.types.Handle %6, float %3, float %4, float undef, i1 true) ; CalculateLOD(handle,sampler,coord0,coord1,coord2,clamped)
Expand Down
8 changes: 5 additions & 3 deletions tools/clang/test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,14 @@ if config.spirv:
def get_dxil_version():
result = subprocess.run([lit.util.which('dxc', llvm_tools_dir), "--version"], stdout=subprocess.PIPE)
output = result.stdout.decode("utf-8")
pat = re.compile(r"(dxcompiler.dll|libdxcompiler.so|libdxcompiler.dylib): (?P<dxcMajor>[0-9]+)\.(?P<dxcMinor>[0-9]+).*(; (dxil.dll|libdxil.so): (?P<dxilMajor>[0-9]+)\.(?P<dxilMinor>[0-9]+))?")
m = pat.search(output)
dxcPat = re.compile(r"(dxcompiler.dll|libdxcompiler.so|libdxcompiler.dylib): (?P<dxcMajor>[0-9]+)\.(?P<dxcMinor>[0-9]+).")
m = dxcPat.search(output)
dxcMajor = int(m.group("dxcMajor"))
dxcMinor = int(m.group("dxcMinor"))

if None == m.group("dxilMajor"):
dxilPat = re.compile(r"; (dxil.dll|libdxil.so): (?P<dxilMajor>[0-9]+)\.(?P<dxilMinor>[0-9]+)")
m = dxilPat.search(output)
if None == m:
return dxcMajor, dxcMinor
dxilMajor = int(m.group("dxilMajor"))
dxilMinor = int(m.group("dxilMinor"))
Expand Down

0 comments on commit 5e658ac

Please sign in to comment.