File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,23 @@ function __init__()
1616 end
1717end
1818
19- has_tt () = true
19+ force_tt_init () = haskey (ENV , " REACTANT_FORCE_TT_INIT" )
20+
21+ function has_tt ()
22+ if force_tt_init ()
23+ return true
24+ end
25+
26+ # To find whether we have Tenstorrent devices, we can either
27+ #
28+ # * look for devices in `/dev/tenstorrent`, or
29+ # * look for devices in `/sys/bus/pci/devices` with `vendor` equal to `0x1e52`, something like
30+ # any(readchomp(joinpath(dir, "vendor")) == "0x1e52" for dir in readdir("/sys/bus/pci/devices"; join=true))
31+ #
32+ # The former is simpler for our current purposes, so we can go that way.
33+ dev_tt = " /dev/tenstorrent"
34+ return isdir (dev_tt) && length (readdir (dev_tt)) > 0
35+ end
2036
2137function setup_tt_pjrt_plugin! ()
2238 plugin_dir_from_env = get (ENV , " TT_PJRT_PLUGIN_DIR" , nothing )
You can’t perform that action at this time.
0 commit comments