{ "scope": "GV100 clock-gating table loads of Graphics PreInitLocked: _nv033505rm and the loaders beneath it (trace lines 37609 to 37712 of the physical V100 transcript)", "evidence_category": "instruction emulation", "original_artifact_sha256": "5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b", "what_the_writes_are": [ "Lines 37610 to 37663 (54 writes): the (register, value) tables 0x400000 (5 entries), 0x400001 (8), 0x400002 (23), 0x400003 (14) of the Graphics function at +1478 (_nv033738rm, load flag 1), then table 0x13b000 (4) written by _nv030976rm. Feature number 7.", "Lines 37664 to 37712 (49 writes): the first value column of the (register, first, second) tables 0x400000 (5), 0x400001 (9), 0x400002 (20), 0x400003 (15), written by the GPU-object function at +5c8 (_nv030977rm) called from the Graphics function at +1480 (_nv033764rm). Feature number 0x13. No second-family table 0x13b000 is written on this path although the data has one.", "The read of 0x200 at line 37609 is the Graphics function at +d10 (_nv033245rm, PMC enable bit 12) called by _nv033505rm; the read at line 37608 is the same function called by the caller _nv033667rm.", "The binary has no names. The first family is called BLCG and the second SLCG in the Rust module after the usual register naming; that naming is an inference. What is verified is the table data, the feature numbers 7 and 0x13, and the write rules." ], "call_chain_from_first_open": { "verified_in_disassembly": [ "_nv033667rm (Graphics PreInitLocked body) calls Graphics+d10 with third argument 0, then Graphics+1348 when it returns non-zero, then _nv033505rm unconditionally (direct call at 0x61ec1f). This is the only reference to _nv033505rm in the object.", "_nv033505rm: Graphics+d10(gpu, graphics, 0); when non-zero Graphics+1478(gpu, graphics, 1), _nv030976rm(gpu, 0x13b000), Graphics+1038 when byte Graphics+1596 is set, Graphics+1480(gpu, graphics). Returns 0.", "_nv033738rm and _nv033764rm: table 0x400000; 0x400001 when byte Graphics+160c is set; when Graphics+c78 returns non-zero table 0x400002 and, with Graphics+160c set, 0x400003.", "_nv030976rm, _nv030310rm, _nv030977rm use GPU+740, +748, +750, +758, +760, +768." ], "taken_from_earlier_reports_not_re-verified_here": [ "reports/gpu-stage-engine-worklist.json: Graphics (engine ordinal 33) PreInitLocked wrapper _nv003645rm reaches _nv033667rm through class vtable slot 0x1b8.", "HANDOFF.md: first open _nv000790rm runs the PreInit wrapper _nv031503rm, whose GPU callback is the PF wrapper _nv031221rm and base pass _nv031220rm, which dispatches the engines' PreInit callbacks." ], "binder_selected_slots": { "GPU+0x5c8": "_nv030977rm", "GPU+0x740": "_nv030423rm", "GPU+0x748": "_nv030728rm", "GPU+0x750": "_nv030519rm", "GPU+0x758": "_nv030891rm", "GPU+0x760": "_nv030902rm", "GPU+0x768": "_nv030894rm", "Graphics+0xd10": "_nv033245rm", "Graphics+0x1478": "_nv033738rm", "Graphics+0x1480": "_nv033764rm", "Graphics+0xc78": "_nv032989rm", "Graphics+0x1038": "_nv031785rm" } }, "gating_conditions": { "all tables": "PMC enable (0x200) bit 12 set, else _nv033505rm writes nothing. Traced value 0x1fecdff1.", "first family (_nv030976rm)": "Nothing when the +11d8 object of the GPU+22c8 object exists and its byte 183 is set, or the table is not listed. Values are written when _nv031034rm(gpu, 7, descriptor) is not 1, zero otherwise; for the Graphics tables also zero when byte GPU+6d41 is set. Table 0x400002 with byte 280 of the GPU+22c8 object set asks the +11d8 object's function at +178 per register and writes zero when it returns non-zero. The result is recorded with _nv031133rm(gpu, 7, descriptor, flag).", "second family (_nv030977rm)": "Nothing when the +11d8 object's byte 184 is set or the table is not listed. First column when _nv031034rm(gpu, 0x13, descriptor) is not 1 (then recorded with _nv031133rm flag 1), second column otherwise; table 0x9a0000 with byte 189 set always takes the second column. Table 0x240000 is bracketed by _nv042924rm/_nv042925rm when the GPU+22c8 object has its +11c0 pointer and byte 269 and _nv042890rm returns non-zero, and with byte 18b set is handed to the +11d8 object's function at +118 instead of being written.", "descriptor": "0xd334df00 for tables 0x400000 to 0x400003 (GPU+768 _nv030894rm), otherwise GPU+750 (_nv030519rm, 18 pairs, 0xb33b1500 when unlisted).", "write route": "Tables 0x400000 to 0x400003 go through the function at +40 of the vtable of the +17a8 object of the Graphics object _nv000333rm returns; other tables through _nv053912rm on GPU+4120.", "gv100_values": { "Graphics+1596": "0 (HAL property, reports/gv100-engine-hal-bindings.json), so Graphics+1038 is not called", "Graphics+d10": "_nv033245rm", "Graphics+1478": "_nv033738rm", "Graphics+1480": "_nv033764rm", "Graphics+c78": "_nv032989rm (service here)", "GPU+5c8": "_nv030977rm", "Graphics+160c": "runtime field, not a HAL property; set on the traced V100 because tables 0x400001 and 0x400003 were written", "Graphics+c78 result": "non-zero on the traced V100 because tables 0x400002 and 0x400003 were written", "feature states": "_nv031034rm did not return 1 for (7, 0xd334df00), (7, 0x174e2100) and (0x13, 0xd334df00) on the traced V100, and GPU+6d41 was clear, because table values and first-column values were written", "GPU+22c8": "present on the traced V100 (inferred): with it absent the original reads through a null pointer on table 0x400002. Its +11d8 object, if any, had bytes 183 and 184 clear." } }, "implemented": [ "Core gpu::clock_gating: graphics_clock_gating (_nv033505rm), graphics_blcg (_nv033738rm, both the load and the zeroing branch), graphics_slcg (_nv033764rm), load_blcg (_nv030976rm), clear_blcg (_nv030310rm), load_slcg (_nv030977rm), blcg_table (_nv030423rm/_nv030556rm), slcg_table (_nv030728rm/_nv030732rm), engine_descriptor (_nv030519rm), is_graphics_table (_nv030894rm); _nv030891rm, _nv030902rm and _nv033245rm are inline.", "Core gpu::clock_gating_tables: BLCG (21 tables), SLCG (30 tables), ENGINE_DESCRIPTORS (18 pairs), 237 entries, generated from .data+0x46c40, .data+0x47720 and .rodata+0x4ce0f00 of the original object by the harness (--write-tables).", "tools/check_gpu_clock_gating_binary.py runs the original instructions and writes target/gpu-stage/original-clock-gating.txt; the ignored test gpu::clock_gating::tests::compare_original_clock_gating compares status and the full call/register trace of every case and every table row." ], "rust_public_api": [ "graphics_clock_gating(&mut S, Inputs, GraphicsInputs) -> Result", "graphics_blcg(&mut S, Inputs, GraphicsInputs, load: bool) -> Result", "graphics_slcg(&mut S, Inputs, GraphicsInputs) -> Result<(), NvStatus>", "load_blcg(&mut S, Inputs, table: u32) / clear_blcg(&mut S, table: u32) / load_slcg(&mut S, Inputs, table: u32) -> Result<(), NvStatus>", "blcg_table(u32) -> &'static [(u32, u32)], slcg_table(u32) -> &'static [(u32, u32, u32)], engine_descriptor(u32) -> u32, is_graphics_table(u32) -> bool", "Inputs { gpu_22c8: Option }>, gpu_6d41 }, GraphicsInputs { gr_160c, gr_1596 }", "trait Services: RegisterIo { feature_state, record_feature, graphics_select, graphics_write32, nv042890, nv042924, nv042925, child_slot_118, child_slot_178, graphics_slot_c78, graphics_slot_1038 }" ], "verification": { "original_cases": 7249, "cases_by_entry": { "gr_clock_gating": 577, "load_blcg": 2168, "clear_blcg": 68, "load_slcg": 4196, "gr_blcg": 144, "gr_slcg": 96 }, "table_rows": 69, "oracle_sha256": "34ba44d2ab9cf26955623281e00d03d3de0ac2c0a4d3fba4640df135be60d60d", "oracle_regenerates_identically": true, "original_functions_executed": [ "_nv005887rm", "_nv005888rm", "_nv005890rm", "_nv005980rm", "_nv005982rm", "_nv030310rm", "_nv030423rm", "_nv030519rm", "_nv030556rm", "_nv030728rm", "_nv030732rm", "_nv030891rm", "_nv030894rm", "_nv030902rm", "_nv030976rm", "_nv030977rm", "_nv033245rm", "_nv033505rm", "_nv033738rm", "_nv033764rm" ], "fixture_supplied": [ "_nv053907rm", "_nv053912rm", "_nv031034rm", "_nv031133rm", "_nv000333rm", "_nv042890rm", "_nv042924rm", "_nv042925rm", "function at +40 of the vtable of the +17a8 object of the Graphics object _nv000333rm returns (register, value)", "functions at +118 and +178 of the +11d8 object of the GPU+22c8 object", "Graphics function at +c78 (GV100 _nv032989rm)", "Graphics function at +1038 (GV100 _nv031785rm)" ], "tables": { "blcg_descriptors": ".data+0x46c40 x 21", "slcg_descriptors": ".data+0x47720 x 30", "engine_descriptors": ".rodata+0x4ce0f00 x 18", "entries": 237, "bytes_sha256": "29abc8da7db58c5d000e11a2eb65a3acab6b5054792ac6a8e0fbfa6d33dcf072", "rust_constants": "src/nvidia/src/gpu/clock_gating_tables.rs", "rust_constants_sha256": "29b42297610f7a07ad6f2ae815a01acad4f62d25b069f64686a80fe0f9488d06" }, "table_check": "The harness asserts the pinned SHA-256 of the table bytes, that clock_gating_tables.rs equals the text it generates from the object, and puts every table in the oracle; the original instructions read the same bytes from the relocated .data and .rodata images during the cases.", "memory_write_check": "After every case the GPU, Graphics, GPU+22c8, +11d8 and Graphics-lookup object images and the table data are compared with their state before the call; nothing changes.", "physical_trace_reproduced": "With PMC enable 0x1fecdff1, Graphics+160c set, Graphics+c78 returning 1, feature states 0 and the GPU+22c8 object present, the original instructions and the Rust unit test first_open_reproduces_the_physical_register_sequence both give the read of 0x200 and the 103 writes of lines 37610 to 37712 in order (the harness also compares its embedded list with target/trace/b3-bar0.txt when that file exists). 99 of them are Graphics-register-object writes, 4 (table 0x13b000) direct writes.", "clock_gating_tests_passed": 6, "workspace_tests_passed": 564, "strict_clippy_and_format_passed": true }, "binary_versus_pseudocode": [ "_nv033738rm: the pseudocode shows the first _nv030976rm call without arguments; the binary passes (gpu, 0x400000).", "_nv030977rm: the pseudocode duplicates the tail into two arms; in the binary both arms do the same thing apart from how often GPU+760 is called (a pure comparison with 0x240000). _nv042890rm is called once before and once after the writes when the +11c0 pointer and byte 269 are set.", "_nv030976rm: the pseudocode's lVar10 + 0x280 is the GPU+22c8 object, read without a null test inside the write loop of table 0x400002; the +11d8 pointer is likewise called through untested. The Rust returns INVALID_ARGUMENT at that point (after the feature calls and the Graphics lookup, before the first write) where the original would fault.", "The loaders use RBP as a second stack pointer, which the pseudocode shows as unaff_RBP locals." ], "limits": [ "Production first open does not call any of this; the kernel module is unchanged.", "_nv031034rm and _nv031133rm (feature state and record), _nv000333rm and the Graphics register object, _nv042890rm/_nv042924rm/_nv042925rm, the +11d8 object's functions, Graphics+c78 (_nv032989rm) and Graphics+1038 (_nv031785rm) are Services methods, not implemented.", "That the Graphics register object's write is a plain BAR0 write is inferred from the physical transcript, not from its code.", "The classes of the GPU+22c8 object and its +11d8 object were not identified.", "Rest of _nv033667rm (engine-list updates, _nv034063rm, _nv031723rm, _nv031724rm, Graphics+1348, _nv034062rm) is not implemented.", "A provider that returns a value with a zero low byte but non-zero upper bits from a boolean function is not modelled; the Services methods return bool." ], "tested_sources_sha256": { "src/nvidia/src/gpu/clock_gating.rs": "934a8e666fdbe725cc0d221f2bb7f19f90011343c6054d300a793bee031c0ffb", "src/nvidia/src/gpu/clock_gating_tables.rs": "29b42297610f7a07ad6f2ae815a01acad4f62d25b069f64686a80fe0f9488d06", "tools/check_gpu_clock_gating_binary.py": "0e37126cf1ca2e281ea9a1e61bf43b8d5be3bfe2a089f5e7654248328b592e20" }, "reports": [ "reports/gpu-clock-gating-original.json" ] }