File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1414
1515# All the iree_vulkan related functionalities go here.
1616
17+ from os import linesep
1718from shark .iree_utils ._common import run_cmd
1819
1920
21+ def get_vulkan_device_name ():
22+ vulkaninfo_dump = run_cmd ("vulkaninfo" ).split (linesep )
23+ vulkaninfo_list = [s .strip () for s in vulkaninfo_dump if "deviceName" in s ]
24+ if len (vulkaninfo_list ) == 0 :
25+ raise ValueError ("No device name found in VulkanInfo!" )
26+ if len (vulkaninfo_list ) > 1 :
27+ print (
28+ f"Found { len (vulkaninfo_list )} device names. choosing first one: { vulkaninfo_list [0 ]} "
29+ )
30+ return vulkaninfo_list [0 ]
31+
32+
2033def get_vulkan_triple_flag (extra_args = []):
2134 if "-iree-vulkan-target-triple=" in " " .join (extra_args ):
2235 print (f"Using target triple from command line args" )
2336 return None
2437
25- vulkan_device_cmd = "vulkaninfo | grep deviceName"
26- vulkan_device = run_cmd (vulkan_device_cmd ).strip ()
38+ vulkan_device = get_vulkan_device_name ()
2739 if all (x in vulkan_device for x in ("Apple" , "M1" )):
2840 print (f"Found { vulkan_device } Device. Using m1-moltenvk-macos" )
2941 return "-iree-vulkan-target-triple=m1-moltenvk-macos"
You can’t perform that action at this time.
0 commit comments