Repository navigation
Runtime: one model table for model selection; model=L refused by name - #93
Merged
Merged
Conversation
…refused by name clean/runtime/model_select.h (header only) holds the model table (name, converter map, folder under the model directory, native D3D12 support) and the parser of the runtime option model=<name>. ModelId gains L. model_from_options in both runtime builds uses the shared parser; model=L is refused as "not part of this build yet" until its network exists. The backend-3 gates, runtime_model() and the interop's map names and model K folder come from the table. Model M and model K: same defaults, names, folders and messages. test_model_select builds a C++ check twice (with and without model K) and checks the table and the exact messages. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime's model selection now goes through one model table instead of comparisons against Model M by hand.
ModelIdgainsL, and the runtime optionmodel=Lis recognised and refused by name until Model L's network exists.Nothing changes for Model M or model K: same defaults, same file names and folders, same messages.
What changes
clean/runtime/model_select.h: the model table (name, converter map file, folder under the modeldirectory, native D3D12 support),
model_info(id),model_from_name,last_model_option(the parser ofmodel=<name>, the last one wins, as before) andnative_d3d12_models(). Header only, so every runtime build(with and without model K, and the native D3D12 test builds that list their sources) gets it without a new source
file.
clean/k/runtime/model_k.h:enum class ModelId { M, K, L }.model_from_optionsinclean/k/runtime/model_k.cppandclean/runtime/no_model_k.cpp: both use the shared parser(the two copies of the loop are gone).
model=Lnow gives "Model L is not part of this build yet (runtime optionmodel=L); remove the option to use Model M" in both builds. The messages for an unknown value and for model K are
word for word the old ones.
clean/runtime/runtime.cpp: the backend-3 gates ask the table whether the model runs on native D3D12. The messagesare built from it and read exactly as before ("native D3D12 supports Model M only", "... backend 3 and Model M").
runtime_model()returns the table's name.clean/runtime/interop/backend.cpp: the preset-M / preset-K map names and model K's folder under the model directorycome from the table (the same strings).
The only behaviour change:
model=L, which used to be refused as an unknown model, is now refused by name. As for K, thelast
model=decides, somodel=L;model=Mselects Model M.Refs #89
Tested
clean/tests/test_model_select.py(CI runs it): buildsclean/tests/test_model_select.cpptwice, with model K(
model_k.cpp) and without (no_model_k.cpp,-DWG_NO_MODEL_K), and runs both. It checks the table rows (M first,the old map names and folder, native D3D12 for M only) and
model_from_optionsfor the default,model=M/m, thelast-one-wins rule,
model=K(selected, or the exact no-K-build refusal) and an unknown or empty value (the exact oldmessages,
known: M, K/known: M). It also checksmodel=Landmodel=l. Result: both builds, 0 failures.python clean/runner/build.py --runtime-only --no-embedwith the HIP SDK 7.2 clang++, with model K and with--no-model-k: both libraries build, 0 warnings.clean.tests.test_model_selectandclean.tests.test_no_model_klocally: 5 tests, OK (2 skipped: they need a --no-model-k build folder). The full CPU Python test set runs in CI.Not tested