Skip to content

Add Windows OpenCL CI via pocl - #1338

Merged
jgabry merged 4 commits into
v1.0from
win-ci-opencl
Oct 22, 2026
Merged

jgabry merged 4 commits into
v1.0from
win-ci-opencl

Conversation

@andrjohns

Copy link
Copy Markdown
Collaborator

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

I've added a recipe for PoCL to MSYS so we can also run the windows opencl tests in CI.

Windows OpenCL is a bit of a pain in that it requires a registry entry instead of just looking in the PATH when running in an elevated shell (which GHA does), which is why the changes in this PR don't just update the PATH like the other platforms

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Andrew Johnson

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@codecov-commenter

codecov-commenter commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v1.0@70f963a). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             v1.0    #1338   +/-   ##
=======================================
  Coverage        ?   94.00%           
=======================================
  Files           ?       19           
  Lines           ?     9232           
  Branches        ?        0           
=======================================
  Hits            ?     8679           
  Misses          ?      553           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jgabry
jgabry changed the base branch from master to v1.0 October 21, 2026 15:49
@jgabry

jgabry commented Oct 21, 2026

Copy link
Copy Markdown
Member

Thanks! I rebased this to target the v1.0 branch (it hasn't been merged to master yet) and am going to rerun CI.

@jgabry jgabry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One real change suggested and then one option nitpick.

Comment thread .github/workflows/R-CMD-check.yaml Outdated
$prefix = "$env:MSYS2_LOCATION/$($env:MSYSTEM.ToLowerInvariant())"
"$prefix/bin" >> $env:GITHUB_PATH
# Avoid mixing MSYS2 and Rtools runtime libraries via -L.
"LDLIBS_OPENCL='$prefix/lib/libOpenCL.dll.a'" >> $env:GITHUB_ENV

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"LDLIBS_OPENCL='$prefix/lib/libOpenCL.dll.a'" >> $env:GITHUB_ENV
"LDLIBS_OPENCL='$($prefix.Replace('\', '/'))/lib/libOpenCL.dll.a'" >> $env:GITHUB_ENV

The failures on the two OpenCL Windows jobs are all Rcpp::sourceCpp() builds (model methods and exposed functions), and they seem to come from the backslashes in this path:

LDLIBS_OPENCL='D:\a\_temp\msys64/ucrt64/lib/libOpenCL.dll.a'

I asked Claude to look into it:

Stan Math appends $(LDLIBS_OPENCL) to LDLIBS whether or not STAN_OPENCL is set, so every link gets it. CmdStan's make keeps the quotes, so compiling models works, but cmdstanr reads the flags with make print-LDLIBS (echo drops the quotes) and passes the value to R CMD SHLIB in PKG_LIBS, where sh eats the backslashes:

ld.exe: cannot find D:a_tempmsys64/ucrt64/lib/libOpenCL.dll.a

Forward slashes in this one value should fix it. The PATH entry and
the registry value can stay as they are, since the OpenCL tests passed
with them:

"LDLIBS_OPENCL='$($prefix.Replace('\', '/'))/lib/libOpenCL.dll.a'" >> $env:GITHUB_ENV

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to go ahead and make this change so that it reruns CI and we can see if it passes. Can always revert if necessary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that worked, will merge now

Comment thread .github/workflows/R-CMD-check.yaml Resolved
cmdstanr reads LDLIBS with make print-LDLIBS, which drops the quotes,
and passes it to R CMD SHLIB, where sh drops the backslashes from the
MSYS2 location.
@jgabry jgabry mentioned this pull request Oct 21, 2026
2 tasks done
@jgabry
jgabry merged commit 913494b into v1.0 Oct 22, 2026
19 checks passed
@jgabry
jgabry deleted the win-ci-opencl branch October 22, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants