Skip to content

ExprInterpreter.#9047

Open
mcourteaux wants to merge 6 commits intomainfrom
martijn/expr-interpreter
Open

ExprInterpreter.#9047
mcourteaux wants to merge 6 commits intomainfrom
martijn/expr-interpreter

Conversation

@mcourteaux
Copy link
Contributor

@mcourteaux mcourteaux commented Mar 16, 2026

Second step in addressing #9044.

Currently no tests, as that will come naturally when we add follow up PRs to address the other tasks in #9044. Although my testing when working with this on #8629 showed correct values for what it's worth.

🙏 I'd like to ask for a merge without additional tests, as I don't want to waste more time on this than needed. If we merge this, I can move forward with #8629 .

First step in addressing #9044

Co-authored-by: Gemini 3.1 Pro <gemini@aistudio.google.com>
@mcourteaux mcourteaux force-pushed the martijn/expr-interpreter branch from e836b13 to 4e4cf93 Compare March 16, 2026 17:12
result = apply_unary(op->type, args[0], [](auto a) { return std::log(a); });
} else if (op->name == "sqrt") {
result = apply_unary(op->type, args[0], [](auto a) { return std::sqrt(a); });
} else if (op->is_intrinsic(Call::strict_add)) {
Copy link
Member

Choose a reason for hiding this comment

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

This should just be:

if (op->is_strict_intrinsic()) {
  Expr lowered = unstrictify_float(op);
  lowered.accept(this);
}

Also instead of interpreting the fixed-point instrinsics (e.g. halving add), in the else case at the bottom you can call lower_intrinsic(op) and try again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll leave strict_fma and redirect it to std::fma().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no helper function to tell if an intrinsic is a fixed-point intrinsic.

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.

2 participants