Skip to content

Keep a kernel's program alive while the kernel exists - #597

Open
maleadt wants to merge 1 commit into
mainfrom
tb/kernel-program-ref
Open

maleadt wants to merge 1 commit into
mainfrom
tb/kernel-program-ref

Conversation

@maleadt

@maleadt maleadt commented Oct 28, 2026

Copy link
Copy Markdown
Member

Compilation creates a Program, creates the kernel from it and drops the Program. Once that object is finalized, Intel's CPU runtime treats the program handle as invalid even though the kernel still uses it, so kernel.program (clGetKernelInfo + clRetainProgram) throws CL_INVALID_PROGRAM. PoCL keeps the program alive internally, so it isn't affected.

This is the intermittent "program backend switch" failure on the intel_cpu jobs (e.g. on #595): it happens whenever a collection runs between compiling and querying the kernel. Kernels created from a Program now keep a reference to it. The added test fails on Intel CPU without the change.

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.71%. Comparing base (4828021) to head (48f5173).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #597   +/-   ##
=======================================
  Coverage   90.71%   90.71%           
=======================================
  Files          18       18           
  Lines        1799     1799           
=======================================
  Hits         1632     1632           
  Misses        167      167           

☔ 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.

Compilation creates a `Program`, creates the kernel from it and drops the
`Program`. Once that object is finalized, Intel's CPU runtime treats the
program handle as invalid even though the kernel still uses it, so
`kernel.program` (clGetKernelInfo + clRetainProgram) throws
CL_INVALID_PROGRAM. This made the "program backend switch" test fail
whenever a collection ran between compiling and querying the kernel.
@maleadt
maleadt force-pushed the tb/kernel-program-ref branch from 777ff95 to 48f5173 Compare October 28, 2026 20:14

This branch has not been deployed

No deployments
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.

1 participant