Skip to content

test(miopen): add RNN/GRU scale coverage for training and FP32 (ALMIOPEN-2149) - #10254

Open
peymanr wants to merge 2 commits into
ROCm:developfrom
peymanr:users/prazaghi/almiopen-2149-rnn-scale
Open

test(miopen): add RNN/GRU scale coverage for training and FP32 (ALMIOPEN-2149)#10254
peymanr wants to merge 2 commits into
ROCm:developfrom
peymanr:users/prazaghi/almiopen-2149-rnn-scale

Conversation

@peymanr

@peymanr peymanr commented Jul 31, 2026

Copy link
Copy Markdown

Summary

JIRA ID: ALMIOPEN-2149

The only existing at-scale RNN test (lstm_large_workspace.cpp) covers LSTM forward-inference in FP16 only. This PR adds rnn_large_workspace.cpp with three new test suites that close the gaps identified in ALMIOPEN-2149:

Suite Mode Dtype Direction Tests
GPU_GRU_LargeWorkspace_FP32 GRU FP32 bidirectional workspace overflow tripwire, forward training, backward data
GPU_RNNVanilla_LargeWorkspace_FP32 RNN (tanh) FP32 bidirectional workspace overflow tripwire, forward training, backward data
GPU_LSTM_LargeWorkspace_FP32 LSTM FP32 bidirectional workspace overflow tripwire, forward training, backward data

All suites use the same spatial config as the existing test (batch=1000, seq=600, input=60, hidden=128, layers=4, bidirectional). Workspace byte counts at this config exceed INT_MAX for every mode:

  • GRU FP32: workspaceScale=4 → ~9.8 GB
  • Vanilla RNN FP32: workspaceScale=1 → ~2.5 GB
  • LSTM FP32: workspaceScale=6 → ~14.7 GB

Each suite includes:

  • A GetWorkspaceSizeOverflowsInt tripwire that fails if a future change shrinks the workspace below INT_MAX — catching any regression silently.
  • A ForwardTraining test exercising miopenRNNForwardTraining end-to-end with properly sized workspace + reserve buffers.
  • A BackwardData test running forward first (to populate reserve space) then verifying miopenRNNBackwardData succeeds.

Tests skip gracefully (GTEST_SKIP) when the device lacks sufficient memory. The new file is picked up automatically by the existing file(GLOB TESTS *.cpp) in CMakeLists.txt; no build-system changes are required.

Test plan

  • Build miopen_gtest with MIOPEN_TEST_SINGLE_GTEST=ON and confirm rnn_large_workspace.cpp is included
  • Run Standard/GPU_GRU_LargeWorkspace_FP32.* on gfx942 (MI325X / TW325) — expect pass or SKIP if VRAM < required
  • Run Standard/GPU_RNNVanilla_LargeWorkspace_FP32.* — same
  • Run Standard/GPU_LSTM_LargeWorkspace_FP32.* — same
  • Verify test names pass check_names.py (GPU prefix + FP32 suffix, Standard instantiation)

🤖 Assisted by PR Pundit

…32 (ALMIOPEN-2149)

The only existing at-scale RNN test (lstm_large_workspace.cpp) covers
LSTM forward-inference in FP16.  This commit adds a new test file that
closes three gaps identified in ALMIOPEN-2149:

  1. GRU FP32 — forward training + backward data with workspace > INT_MAX
  2. Vanilla RNN (tanh) FP32 — forward training + backward data with workspace > INT_MAX
  3. LSTM FP32 — forward training + backward data with workspace > INT_MAX
     (existing coverage is FP16 inference only)

Each suite follows the pattern established in lstm_large_workspace.cpp:
  * A GetWorkspaceSizeOverflowsInt tripwire that fails if a future change
    shrinks the workspace below INT_MAX for the chosen config.
  * A ForwardTraining* test that allocates all required buffers and
    verifies miopenRNNForwardTraining returns miopenStatusSuccess.
  * A BackwardData* test that runs forward first to populate reserve
    space, then verifies miopenRNNBackwardData returns miopenStatusSuccess.

Config used for all suites (same spatial shape as the existing LSTM test):
  batch=1000, seq=600, input=60, hidden=128, layers=4, bidirectional, FP32

Workspace byte counts at this config (formula: workspaceScale*nLayers*
seqLen*batch*hidden*sizeof(dtype)*(bidir?2:1)):
  GRU   FP32: workspaceScale=4 → ~9.8 GB > INT_MAX
  RNN   FP32: workspaceScale=1 → ~2.5 GB > INT_MAX
  LSTM  FP32: workspaceScale=6 → ~14.7 GB > INT_MAX

All tests skip gracefully (GTEST_SKIP) when the device has insufficient
memory for the full training run.  The CMakeLists.txt file(GLOB) picks up
the new file automatically; no build-system changes are required.

JIRA ID: ALMIOPEN-2149
@therock-pr-bot

therock-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

Pre-commit check failed

pre-commit failed

Please run locally:

  • python -m pip install pre-commit
  • pre-commit install
  • pre-commit run --all-files --show-diff-on-failure

This repo uses .pre-commit-config.yaml.

Fix clang-format violations in rnn_large_workspace.cpp flagged by pre-commit CI.
Resolves: ALMIOPEN-2149
@therock-pr-bot

therock-pr-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant