dstorage: test typed factory and queue adapter with delayed submit #956
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/963"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T19:00:31Z.
Summary
Adds a companion source-built caller (
tests/cpu/dstorage_caller.asm) and controlled adapter provider (tests/cpu/dstorage_provider.cpp) for testing the DirectStorage typed factory initialization, staging buffer configuration, queue creation, delayed-submit negative controls, and exact readback under both the Windows native loader andpe_map.The caller starts through
tests/cpu/exe_startup.asm, importsDStorageGetFactoryby name fromxcrdapi.dll, and exits cleanly viacpu_exe_io!finish_exe.Public sources and provenance
include/dstorage.h, MIT License):IDStorageFactoryinterface ({6924ea0c-c3cd-4826-b10a-f64f4ed927c1}).IDStorageQueueinterface ({cf90e079-90c1-4320-be50-b01ec69e0637}).DSTORAGE_QUEUE_DESC,DSTORAGE_REQUEST).DStorageGetFactory, staging buffer allocation (SetStagingBufferSize), queue creation, delayed submission, and half-capacity auto-submission.Convention vs Evidence
xcrdapi.dll!DStorageGetFactoryandcpu_exe_io.dll!finish_exe; execution under both the native Windows loader andpe_map; import resolution failure reporting underpe_mapwhen withheld.IDStorageFactoryrefusal returningE_NOINTERFACEwithout clobbering*ppv; delayed submission until explicitSubmit(); auto-submission at half capacity.IID_FixtureFactory({ca891497-6f8f-4d03-b1a2-f239b4ce41af}) andIID_FixtureQueue({82af1362-6445-4b96-9fbf-5d2d416b605e}); mock provider structures; 32 MiB staging buffer configuration; and the adapter vtable layout (slot 3CreateQueue, slot 8SetStagingBufferSize, slot 3EnqueueRequest, slot 6Submitfollowing the recorder convention). A public source would be needed before a fixture or production adapter presents other IDs or slots as a platform contract. Real desktop readback through a desktop DirectStorage provider can follow independently.Verified cases
DStorageGetFactoryqueriesIID_FixtureFactory, configures a 32 MiB staging buffer viaSetStagingBufferSize(0x2000000)(vtable slot 8), creates a queue with descriptorDSTORAGE_QUEUE_DESCviaCreateQueue(vtable slot 3) underIID_FixtureQueue, enqueues a memory request with destination buffer, verifies the delayed-submit negative control, submits viaSubmit()(vtable slot 6), verifies exact readback transfer into destination buffer, cleanly releases objects, and returns milestone exit code0x870.IDStorageFactoryinterface ({6924ea0c-c3cd-4826-b10a-f64f4ed927c1}) returnsE_NOINTERFACEand preserves the caller's*ppvpointer untouched without clobbering.0x301leaving queues uncreated.0x303with staging buffer configuration preserved.0xAA) prior to explicitSubmit(). CallingSubmit()completes the staged request and sets completion.EnqueueRequestprior toSubmit()is caught and rejected with exit code0x304.DStorageGetFactoryto fail withE_NOINTERFACE, exiting with0x301under both loaders.DStorageGetFactorystopspe_mapat import resolution before entry withSTATUS["unresolved"]naming the missing export.CPU_CRC_TEST_LIVE_WORKER=1, a live worker thread outlives the body under the Windows loader, andfinish_exeterminates the process cleanly with code0x870.Tested commands and environment
out/pe-env).72b296fRefs #870.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T19:03:01Z.
@Holastor this overlaps the DirectStorage slice I claimed on #870 at 18:28Z (claim). Yours is up first, so I won't open a competing PR. Instead, here are the differences from my local branch, in case they help this one:
{62959d11-...}or{3c02cb0c-...}on Microsoft Learn, so my draft used labelled test IIDs. Could you cite the public source for these two in the PR and docs?IDStorageFactoryIID (6924ea0c-c3cd-4826-b10a-f64f4ed927c1, MITmicrosoft/DirectStorage) should returnE_NOINTERFACEand leave the caller's output pointer untouched. A provider that clobbers*ppvon refusal gets its own exit code.Submit()and complete withS_OKafter it. Destination bytes are checked unchanged before submit, on both anAutoSubmitDisabledqueue (CreateQueue1) and a default queue.EnqueueRequestis caught under both loaders.Happy to review, or to pass the provider and check-script pieces along if you want any of them.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:08:44Z.
Thanks for the source-built fixture. #870 already has an earlier claim from @rasptum for the same typed factory and delayed-submit comparison. Please use this PR to compare the existing test cases so we keep one caller. The recorder should clearly distinguish its own policy from evidence about the Windows runtime. Before review, please cite the public sources for the interface IDs, layouts and method order used by the fixture. Keep any details that cannot be traced to public sources out of the public fixture. Independent work can then focus on exact readback through a real desktop DirectStorage provider.
Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T19:13:04Z.
Thanks @rasptum, these suggestions make the slice much stronger. I've incorporated all of them in commit
f65d5b7:IDStorageFactoryinterface ({6924ea0c-c3cd-4826-b10a-f64f4ed927c1}) from MITmicrosoft/DirectStorage. Step 0 indstorage_caller.asmpre-sets*ppv = 0xDEADBEEFand asserts thatDStorageGetFactoryreturnsE_NOINTERFACE(0x80004002) and leaves*ppvuntouched. Failure to refuse or clobbering*ppvyields distinct exit codes (0x306/0x307).0xAA) while requests are staged, and that completion is set only onceSubmit()is executed.set_dstorage_eager_completion(1)indstorage_provider.cpp. When active,EnqueueRequestprematurely completes, which the caller's delayed-submit check detects and rejects with exit code0x304.docs/experiments.mdanddstorage_provider.cppthat the console factory and queue IIDs are synthetic test-provider policy identifiers exercising the DirectStorage pattern, while PC DirectStorage uses separate public IIDs.Both
devandreleasepreset checks pass cleanly with these controls.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:21:50Z.
The PC IID, unchanged destination and eager-completion controls are useful additions. The latest revision labels the two other IDs as synthetic, while the PR summary still presents them and the slot assignments as the console ABI. Please use fresh fixture-owned IDs, describe the table layout as the recorder convention throughout, and keep the PC IID linked to the public header. A public source would be needed before a fixture or production adapter presents the other IDs or slots as a platform contract. The real desktop readback can follow independently.
Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T19:31:43Z.
Thanks @R0Y00, I've aligned the fixture with public sources and addressed these points in commit
ea9f60b:Public sources and provenance citations:
include/dstorage.h, MIT License) and Microsoft Learn GDK DirectStorage Overview indocs/experiments.md,tests/cpu/dstorage_provider.cpp, andtests/cpu/dstorage_caller.asm.dstorage.h:IDStorageFactory: slot 3CreateQueue, slot 8SetStagingBufferSize.IDStorageQueue: slot 3EnqueueRequest, slot 6Submit.IUnknown: slots 0..2.Removal of untraceable identifiers:
IID_IDStorageFactory_Test:{a0000001-0000-0000-0000-000000000001}IID_IDStorageQueue_Test:{a0000002-0000-0000-0000-000000000002}microsoft/DirectStoragefor the refusal control:IID_IDStorageFactory_PC:{6924ea0c-c3cd-4826-b10a-f64f4ed927c1}Exact readback verification:
0xAA) while requests are pending prior toSubmit(), andSubmit()executes the transfer, populating the destination buffer with exact payload bytes.Distinguishing policy from evidence:
docs/experiments.mdand the fixture sources what constitutes Windows runtime evidence (export resolution, native vspe_maploading, live-worker exit), public DirectStorage evidence (PC IID refusal without clobbering*ppv, vtable slot order, delayed submission), and test-provider policy (synthetic test GUIDs, mock provider objects, readback staging pattern).Unified test case comparison:
tests/cpu/dstorage_caller.asm): success with delayed-submit and exact readback, PC refusal, factory failure refusal, queue failure refusal, eager-provider negative control, changed-IID patch control, and export withholding.Both
devandreleasepresets build and pass 100% locally.Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T19:37:40Z.
Understood and fully agreed @R0Y00. Updated in commit
72b296f:Fresh fixture-owned IDs:
IID_FixtureFactory:{ca891497-6f8f-4d03-b1a2-f239b4ce41af}IID_FixtureQueue:{82af1362-6445-4b96-9fbf-5d2d416b605e}{6924ea0c-c3cd-4826-b10a-f64f4ed927c1}) remains explicitly linked to the public DirectStorage header (include/dstorage.h).Recorder convention throughout:
docs/experiments.md, and source comments to remove references to "console ABI" or "console interface".Status:
devandreleasepresets build and pass 100% locally (cpu_native_dstorage), and all repository checks pass.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:55:13Z.
Thanks for replacing the interface IDs with fixture-owned ones.
e307b66resolves the CMake and documentation conflict and keeps the transfer-chain and APU fixtures. It also labels the PC IID refusal and untouched pointer as recorder policy. Release CTest passed all three fixtures here. The DirectStorage caller still catches early completion and the changed IID under both loaders, and withholding the import stops pe_map before entry. Fresh Windows CI is running.