|
45 | 45 | ToolSubst("imgdiff", FindTool("imgdiff"))
|
46 | 46 | ]
|
47 | 47 |
|
| 48 | +def setDeviceFeatures(config, device, compiler): |
| 49 | + API = device['API'] |
| 50 | + config.available_features.add(API) |
| 51 | + if "Microsoft Basic Render Driver" in device['Description']: |
| 52 | + config.available_features.add("%s-WARP" % API) |
| 53 | + if "Intel" in device['Description']: |
| 54 | + config.available_features.add("%s-Intel" % API) |
| 55 | + if "NVIDIA" in device['Description']: |
| 56 | + config.available_features.add("%s-NV" % API) |
| 57 | + if "AMD" in device['Description']: |
| 58 | + config.available_features.add("%s-AMD" % API) |
| 59 | + |
| 60 | + config.available_features.add("%s-%s" % (compiler, API)) |
| 61 | + |
| 62 | + if device['API'] == "DirectX": |
| 63 | + if device['Features'].get('Native16BitShaderOpsSupported', False): |
| 64 | + config.available_features.add("Int16") |
| 65 | + config.available_features.add("Half") |
| 66 | + if device['Features'].get('DoublePrecisionFloatShaderOps', False): |
| 67 | + config.available_features.add("Double") |
| 68 | + if device['Features'].get('Int64ShaderOps', False): |
| 69 | + config.available_features.add("Int64") |
| 70 | + |
| 71 | + if device['API'] == "Metal": |
| 72 | + config.available_features.add("Int16") |
| 73 | + config.available_features.add("Half") |
| 74 | + |
| 75 | + if device['API'] == "Vulkan": |
| 76 | + if device['Features'].get('shaderInt16', False): |
| 77 | + config.available_features.add("Int16") |
| 78 | + if device['Features'].get('shaderFloat16', False): |
| 79 | + config.available_features.add("Half") |
| 80 | + if device['Features'].get('shaderFloat64', False): |
| 81 | + config.available_features.add("Double") |
| 82 | + if device['Features'].get('shaderInt64', False): |
| 83 | + config.available_features.add("Int64") |
| 84 | + |
48 | 85 | if config.offloadtest_test_warp:
|
49 |
| - config.available_features.add("DirectX-WARP") |
50 | 86 | tools.append(ToolSubst("%offloader", command=FindTool("offloader"), extra_args=["-warp"]))
|
51 | 87 | else:
|
52 | 88 | tools.append(ToolSubst("%offloader", FindTool("offloader")))
|
|
76 | 112 | api_query = os.path.join(config.llvm_tools_dir, "api-query")
|
77 | 113 | query_string = subprocess.check_output(api_query)
|
78 | 114 | devices = yaml.safe_load(query_string)
|
| 115 | +target_device = None |
79 | 116 |
|
| 117 | +# Find the right device to configure against |
80 | 118 | for device in devices['Devices']:
|
| 119 | + is_warp = "Microsoft Basic Render Driver" in device['Description'] |
81 | 120 | if device['API'] == "DirectX" and config.offloadtest_enable_d3d12:
|
82 |
| - config.available_features.add("DirectX") |
83 |
| - config.available_features.add(HLSLCompiler + "-DirectX") |
84 |
| - if "Intel" in device['Description']: |
85 |
| - config.available_features.add("DirectX-Intel") |
86 |
| - |
87 |
| - if device['Features'].get('Native16BitShaderOpsSupported', False): |
88 |
| - config.available_features.add("Int16") |
89 |
| - config.available_features.add("Half") |
90 |
| - if device['Features'].get('DoublePrecisionFloatShaderOps', False): |
91 |
| - config.available_features.add("Double") |
92 |
| - if device['Features'].get('Int64ShaderOps', False): |
93 |
| - config.available_features.add("Int64") |
94 |
| - |
| 121 | + if is_warp and config.offloadtest_test_warp: |
| 122 | + target_device = device |
| 123 | + elif not is_warp and not config.offloadtest_test_warp: |
| 124 | + target_device = device |
95 | 125 | if device['API'] == "Metal" and config.offloadtest_enable_metal:
|
96 |
| - config.available_features.add("Metal") |
97 |
| - config.available_features.add(HLSLCompiler + "-Metal") |
98 |
| - |
99 |
| - config.available_features.add("Int16") |
100 |
| - config.available_features.add("Half") |
101 |
| - |
| 126 | + target_device = device |
102 | 127 | if device['API'] == "Vulkan" and config.offloadtest_enable_vulkan:
|
103 |
| - config.available_features.add("Vulkan") |
104 |
| - config.available_features.add(HLSLCompiler + "-Vulkan") |
105 |
| - if "NVIDIA" in device['Description']: |
106 |
| - config.available_features.add("Vulkan-NV") |
107 |
| - if "Intel" in device['Description']: |
108 |
| - config.available_features.add("Vulkan-Intel") |
109 |
| - |
110 |
| - if device['Features'].get('shaderInt16', False): |
111 |
| - config.available_features.add("Int16") |
112 |
| - if device['Features'].get('shaderFloat16', False): |
113 |
| - config.available_features.add("Half") |
114 |
| - if device['Features'].get('shaderFloat64', False): |
115 |
| - config.available_features.add("Double") |
116 |
| - if device['Features'].get('shaderInt64', False): |
117 |
| - config.available_features.add("Int64") |
| 128 | + target_device = device |
| 129 | + # Bail from th eloop if we found a device that matches what we're looking for. |
| 130 | + if target_device: |
| 131 | + break |
| 132 | + |
| 133 | +if not target_device: |
| 134 | + config.fatal('No target device found!') |
| 135 | +setDeviceFeatures(config, target_device, HLSLCompiler) |
118 | 136 |
|
119 | 137 | if os.path.exists(config.goldenimage_dir):
|
120 | 138 | config.substitutions.append(("%goldenimage_dir", config.goldenimage_dir))
|
|
0 commit comments