Remat conformance: zero-filled reference buffers to catch read-before-write after the Legacy oracle is removed

Open
#490 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
testing

Research direction

Start by reading the remat conformance tests and the HEAP scheduler implementation; the issue names test/unit/support/LegacyCalculateGrads.c as the removed reference and describes the current reference scheduler setup. Trace how test builds initialize fresh buffers for schedulers, then identify how the reference can receive zero-filled buffers while other schedulers keep their poison pattern. Done means a read-before-write bug causes conformance tests to differ between the reference and poisoned schedulers.

Written by the indexing model from the issue text.

Description

Context

The remat conformance tests compare every scheduler against a reference. Until #4's keyed-randomness PR the reference was a frozen copy of the old gradient driver (test/unit/support/LegacyCalculateGrads.c), whose buffers start as zeros. That PR deletes it (register entry remat D57); the reference becomes the current driver on a plain HEAP + STORE_ALL scheduler.

In test builds every scheduler fills fresh buffers with a poison pattern, and so does the new reference. A layer that reads its output buffer before writing it therefore gives the same wrong result on every side, and the conformance tests stay green. Today the layer unit tests still catch such a bug (rehearsed: removing a zeroing line in MaxPool1d's backward fails UnitTestMaxPool1d and UnitTestMicroBatchStacking, while the conformance binary stays green on the debug build).

Proposal

Give the reference scheduler zero-filled fresh buffers in test builds (a small switch in the HEAP scheduler, used only by the reference). A read-before-write bug then shows up again as a difference between the reference and the poisoned schedulers, for every layer at once, including future layers without a dedicated unit test.

Accepted as a known limit for #4 PR5b; tracked here as a follow-up.

Dominant language
C
Stars
2
Forks
3
Avg merge
13h 6m
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from es-ude/OnDeviceTraining

All issues in es-ude/OnDeviceTraining

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.