SUGGESTION: Run the OpenCL tests under Oclgrind in CI to catch data races and invalid memory accesses in kernels

オープン
#3,430 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@SteveBronder がすでに取り組んでいます。

2026年10月5日 から。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp
領域
ci-cd, testing

調査の方向性

Start by reading how runTests.py prefixes MPI tests, then inspect the CI setup for where a CPU-only OpenCL test stage belongs. Build test/unit/math/opencl with STAN_OPENCL=true and run its test binaries through Oclgrind with race logging. Done means the stage fails on non-empty logs and can later be made required once the reported races are fixed.

索引モデルが issue の本文から書いたものです。

説明

code cleanup continuous integration dependencies gpu

Description

Motivation. CI runs the OpenCL tests on one GPU. A kernel bug that this device happens to tolerate stays invisible. Example: https://github.com/stan-dev/math/issues/3429, where the cholesky_decompose kernel returns a wrong factor on an AMD GPU because its barriers fence local memory only.

Oclgrind is an OpenCL device simulator. It needs no GPU and checks what real devices do not:

  • data races between work items, including a barrier with the wrong fence flag (--data-races),
  • reads and writes outside a buffer (always on),
  • use of uninitialized values (--uninitialized).

It runs our test binaries unchanged:

oclgrind --data-races --log races.log ./test/unit/math/opencl/cholesky_decompose_test

On develop this reports read-write races in cholesky_decompose, already for the 3×3 case, and nothing once the barriers are fixed. A first local pass also reports races in tridiagonalization_householder.

Suggested steps.

  1. Add oclgrind to the CI image.
  2. Add a CPU-only stage that builds test/unit/math/opencl with STAN_OPENCL=true and runs each test binary through oclgrind --data-races --log <file>. runTests.py already prefixes MPI tests with mpirun; the same mechanism can prefix oclgrind.
  3. Fail the stage when a log is not empty.
  4. Start it as non-blocking and make it required once the existing reports are fixed.
主要言語
C++
スター
845
フォーク
225
平均マージ
3日 9時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stan-dev/math のほかの issue

stan-dev/math の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。