aboutsummaryrefslogtreecommitdiffhomepage
path: root/ptx/src/test/spirv_run/verify.py
blob: 4ef6465ee106341013076b03ef9e13ed5066150a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os, sys, subprocess

def main(path):
    dirs = sorted(os.listdir(path))
    for file in dirs:
        if not file.endswith(".spvtxt"):
            continue
        full_file = os.path.join(path, file)
        print(file)
        spv_file = f"/tmp/{file}.spv"
        # We nominally emit spv1.3, but use spv1.4 feature (OpEntryPoint interface changes in 1.4)
        proc1 = subprocess.run(["spirv-as", "--target-env", "spv1.4", full_file, "-o", spv_file])
        proc2 = subprocess.run(["spirv-dis", spv_file, "-o", f"{spv_file}.dis.txt"])
        proc3 = subprocess.run(["spirv-val", spv_file ])
        if proc1.returncode != 0 or proc2.returncode != 0 or proc3.returncode != 0:
            print(proc1.returncode)
            print(proc2.returncode)
            print(proc3.returncode)

if __name__ == "__main__":
    main(sys.argv[1])