Repository navigation
Add expression keyword to emit_dirichlet - #69
Merged
Merged
Conversation
GPU support needs the generated Dirichlet functions as Expr so a device pass can retype literals and build a device-callable function. emit_kernels and emit_strong already take expression = Val(true); emit_dirichlet now does the same. Default behaviour is unchanged. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: f7b46bdf-7cc3-44dd-b8a4-9205616ff6ac Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GPU support needs the generated Dirichlet functions as
Expr, so that a device pass can retype literals and build a device-callableRuntimeGeneratedFunction.emit_kernelsandemit_strongalready takeexpression = Val(true). This PR givesemit_dirichletthe same keyword. It is CPU-only, has no Ferrite dependency, and can merge on its own.Change
In
src/kernels.jl,emit_dirichlet(analysis; expression = Val(false))passesexpressionthrough to the sharedcompilehelper, the same wayemit_strongdoes. WithVal(true)the return value keeps the same(piece, field, g)shape, with the generatedExprin place of eachg. The docstring is updated to match.The default behaviour is unchanged. The default path (
expression = Val(false)) is already covered end to end:src/frontend.jlcallsemit_dirichlet(an)for every problem with an essential condition, and the existing Kernels tests and Frontend boundary tests pass unchanged.Tests
The new file
test/Kernels/dirichlet_expression.jlcovers three conditions: a constant g (U ~ 1), a space-dependent g (U ~ 0.1y + x) and a time-dependent g (U ~ sin(t) x). Each generatedExpris built into aRuntimeGeneratedFunctionin FiniteElementMethod's own cache. That function is compared withisequalagainst the default compiledgat random points(X, T, P), and the piece and field are checked as well.The constant g still compiles to an
Intliteral and returnsInt64. This PR leaves that alone; the device pass will retype it.Results:
GROUP=Kernels:dirichlet_expression.jl22/22,kernels.jl345/345, in 1m06s.test/Frontend/boundaries.jl: 23/23 and 19/19.--checkpasses on both touched files.This branch merges cleanly with #64 and #65: the test lives in a new file rather than
test/Kernels/kernels.jl.🤖 Posted by an AI agent · harness: Claude Code 2.1.318 · model: claude-opus-5-5
Review: unreviewed
Session: f7b46bdf-7cc3-44dd-b8a4-9205616ff6ac