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
15 changes: 9 additions & 6 deletions clean/converter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ data damaged". This is how a further preset that reuses an existing map version
**Preset L** (Model L, issue #89) is such a row: `"preset": "L"` in a map of version 1 or 4. Its maps use the record
kinds of preset M's (no new element format, op or source kind); its parameters are a block of their own in the same
library file as preset M's, found by its own length and hashes like any source. Its map,
`data/preset-L.v1.map.json` (map version 1; sources W, D and K), has no `"preset"` field, so the caller names the
preset: `wronggpu-convert --map data\preset-L.v1.map.json --preset L --dll <nvngx_dlss.dll> --out <dir>` (API:
`load_map_bytes(..., "L")`). `--preset` reads a map without the field as that preset when the preset uses the map's
version; a map with the field must name the same preset; anything else is "converter data damaged", and an unknown
`--preset` is a usage error (exit 1). Without `--preset` the preset-L map reads as a version-1 map (preset M's message).
`tests/run_tests.py` checks the real map (validation, the messages, `--preset` mismatches) and converts our own random
`data/preset-L.v1.map.json` (the spec side's revision v1.1; map version 1; sources W, D and K), names its preset
(`"preset": "L"`), so `wronggpu-convert --map data\preset-L.v1.map.json --dll <nvngx_dlss.dll> --out <dir>` reads it as
preset L. A caller may still name the preset (`--preset L`; API `load_map_bytes(..., "L")`): a map without the field is
then read as that preset when the preset uses the map's version; a map with the field must name the same preset;
anything else is "converter data damaged", and an unknown `--preset` is a usage error (exit 1). Its perm
`dec0_values` is L's own 13-entry table (role order A0, A1, A2, B0, B1, B2, Cx, Cy, Crho, latent candidate 0..3; role i
reads decoder-block channel `dec0_values[i]`; L has no latent gate); no tensor reads it, so it is for the packer and
runtime, and the converted tensors do not depend on it.
`tests/run_tests.py` checks the real map (validation, the messages, `--preset` mismatches, the 13-entry table) and converts our own random
data in its exact layout at two placements. It also covers preset L with a synthetic library file holding an L block
directly before an M block, and maps for both: each converts its own block, and a file without a preset's block fails
with that preset's message. It also converts an **L-shaped** map
Expand Down
2 changes: 1 addition & 1 deletion clean/converter/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void usage() {
" completely is used (for a map with an optional group, such as preset M's output filter: the\n"
" first that has the group, if any has it). The map names its preset (field \"preset\", or by its\n"
" version: 1 and 4 M, 2 and 3 K, 5 F). --preset names the preset the map is for: a map without the\n"
" field is read as that preset (data/preset-L.v1.map.json: --preset L); a map with it must agree.\n"
" field is read as that preset; a map with it must agree.\n"
" --raw also writes <dir>/raw/<group>/<name>.bin for every tensor.\n";
}

Expand Down
2 changes: 1 addition & 1 deletion clean/converter/src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ bool load_map(const std::string& file_bytes, Map& out, MapError& err);
// The same, for a caller that knows which preset it loads the map for (`expected_preset`, e.g. "L"; "" : as above). A map
// without the field "preset" then gets that preset, when it allows the map's version; a map with the field must name
// the same preset. Anything else (an unknown name, a version the preset does not use, another name): damaged. This is
// how a map written before maps named their preset (the delivered preset-L map has no field) is read as its preset.
// how a map written before maps named their preset (the first delivered preset-L map had no field) is read as its preset.
bool load_map(const std::string& file_bytes, Map& out, MapError& err, const std::string& expected_preset);

// Hex helpers shared with the tests: optional 0x prefix, then 1..max_digits hex digits.
Expand Down
25 changes: 18 additions & 7 deletions clean/converter/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,21 @@ def test_shipped_map_validates(r, shipped_map):


def test_l_real_map(r, lmap):
"""Model L (#89): the delivered preset-L map (data/preset-L.v1.map.json; map version 1, W, D, K; no "preset" field,
so it is loaded with --preset L). It validates; our own random file gives preset L's message (and, without
--preset, preset M's, as for any version-1 map); a mismatching --preset is refused; and its exact layout converts
our own random data at two placements, every tensor of every stage checked against the reference."""
"""Model L (#89): the delivered preset-L map (data/preset-L.v1.map.json, the spec side's revision v1.1; map version 1,
W, D, K; "preset": "L"). It validates; our own random file gives preset L's message, with --preset L and without it
(the map names its preset); a mismatching --preset is refused; L's perm dec0_values is its own 13-entry table (L has
no latent gate; M's map keeps its 17); and its exact layout converts our own random data at two placements, every
tensor of every stage checked against the reference."""
import random
with open(lmap, "rb") as f:
m = json.load(f)
r.check("preset-L map: version 1, sources W, D and K, no \"preset\" field",
m["version"] == 1 and sorted(m["sources"]) == ["D", "K", "W"] and "preset" not in m, (m["version"], sorted(m["sources"])))
r.check("preset-L map: version 1, sources W, D and K, \"preset\": \"L\"",
m["version"] == 1 and sorted(m["sources"]) == ["D", "K", "W"] and m.get("preset") == "L", (m["version"], sorted(m["sources"])))
dv = m["perms"].get("dec0_values", [])
r.check("preset-L map: perm dec0_values has 13 entries, a permutation of 0..12 (role i reads block channel dv[i])",
len(dv) == 13 and sorted(dv) == list(range(13)), dv)
with open(DEFAULT_MAP, "rb") as f:
r.check("...the preset-M map keeps its own 17-entry dec0_values", len(json.load(f)["perms"]["dec0_values"]) == 17)
rng = random.Random(29)
lw = m["sources"]["W"]["length"]
out = r.path("l-real/out", "x")[:-2]
Expand All @@ -287,7 +293,12 @@ def test_l_real_map(r, lmap):
r.check("preset-L map --preset L: valid, W absent -> exit 12, preset L's message", code == EXIT["no_preset_m"] and MSG_NO_PRESET_L in so, so + se[-400:])
r.check("...the log names the preset", "preset L" in se, se[-400:])
code, so, se = r.run(lmap, [big], out)
r.check("preset-L map without --preset: read as version 1 (preset M's message)", code == EXIT["no_preset_m"] and MSG["no_preset_m"] in so, so)
r.check("preset-L map without --preset: the map names preset L (its message)", code == EXIT["no_preset_m"] and MSG_NO_PRESET_L in so, so)
# the same map without its "preset" key (the delivered v1 had none): read as version 1, preset M's message
plain = copy.deepcopy(m)
del plain["preset"]
code, so, se = r.run(r.write("l-real/no-key.json", plain), [big], out)
r.check("the preset-L map without its key and without --preset: preset M's message (version 1)", code == EXIT["no_preset_m"] and MSG["no_preset_m"] in so, so)
for asked in ("K", "F"):
code, so, se = r.run(lmap, [big], out, extra=("--preset", asked))
r.check("preset-L map --preset %s: converter data damaged" % asked, code == EXIT["map_damaged"] and MSG["map_damaged"] in so, so)
Expand Down
4 changes: 2 additions & 2 deletions data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ only layout information and the digests the converter uses to verify the player'
## Converter maps

`preset-M.v1.map.json` (Model M, map version 4), `preset-F.v1.map.json` (Ray Reconstruction, version 5),
`preset-K.v1.map.json` (Model K, version 3) and `preset-L.v1.map.json` (Model L, version 1; read with the converter's
`--preset L`, since it has no `preset` field) tell the converter (`clean/converter`) how to read the network's parameters
`preset-K.v1.map.json` (Model K, version 3) and `preset-L.v1.map.json` (Model L, version 1; the spec side's revision
v1.1, which names its preset and carries L's 13-entry `dec0_values`) tell the converter (`clean/converter`) how to read the network's parameters
from the player's own DLSS file. Each map holds:

- `format`, `version`, `channel_order`, and a `model` line naming the DLSS product and the first DLSS version the map
Expand Down
Loading
Loading