Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tools/ingame/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ Everything after a lone `--` wraps each GPU run, for example a GPU-slot tool.
options to every model choice (e.g. `l_post=own`); `--extra` on `prepare`, `use-m` or `use-l` replaces it for that
choice (`--extra ''` for none), so two variants can run in one session.

Optional `gpu_slot`: `{"command": [...], "env": {...}}`, a command prefix that runs one command in a GPU slot on a
shared PC (for example a slot tool with a hard time cap, ending in its `--`). The launcher's install, repair, update,
uninstall and rollback checks run a short HIP probe on the GPU, so those verbs run through the prefix, with `env`
added. Without `gpu_slot` they run directly, and the session log says the probe ran outside a slot.

2. Run the phases:

```
Expand Down
18 changes: 16 additions & 2 deletions tools/ingame/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def _config_path(argv):
S = CFG.get('settings') or {}
os.makedirs(A, exist_ok=True)
EXTRA = CFG.get('runtime_options_extra', '') # e.g. "l_post=own"; run.py --extra replaces it for one phase
# The launcher's install / repair / update / uninstall / rollback checks run a short HIP probe on the GPU. With
# "gpu_slot": {"command": [<prefix that runs one command in a GPU slot>], "env": {...}} they run through that prefix
# (e.g. a slot tool with a hard cap); without it they run directly and the session log says so.
GPU_SLOT = CFG.get('gpu_slot') or {}
GPU_VERBS = ('install', 'repair', 'update', 'uninstall', 'rollback')


def opts_extra(r):
Expand Down Expand Up @@ -179,13 +184,22 @@ def py(self, name, args, out=None, check=True):
return r.returncode

def wg(self, name, verb_args):
"""The candidate launcher's command line (--out / --log into <a>)."""
"""The candidate launcher's command line (--out / --log into <a>). The verbs whose checks run the launcher's HIP
probe (GPU_VERBS) go through the config's gpu_slot prefix when there is one."""
cmd = [PKG_EXE] + verb_args + ['--out=' + os.path.join(self.a, name + '.json'),
'--log=' + os.path.join(self.a, name + '.log')]
env = clean_env()
if verb_args[:1] and verb_args[0] in GPU_VERBS:
if GPU_SLOT.get('command'):
cmd = list(GPU_SLOT['command']) + cmd
env.update(GPU_SLOT.get('env') or {})
else:
self.log('note: no gpu_slot in the config: the launcher\'s %s runs its HIP probe outside a GPU slot'
% verb_args[0])
if self.dry:
self.log('would run: ' + ' '.join('"%s"' % c if ' ' in c else c for c in cmd))
return 0
r = subprocess.run(cmd, creationflags=NOWIN, env=clean_env())
r = subprocess.run(cmd, creationflags=NOWIN, env=env)
self.log('launcher %s exit %d' % (' '.join(verb_args[:1]), r.returncode))
return r.returncode

Expand Down
Loading