Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

forward_diff_no_inf can't handle throw_undef_if_not

未关闭
#161 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia
领域
compilers

调研方向

从 forward_diff_no_inf! 的实现开始,并检查 forward_visit 中由 throw_undef_if_not 生成的 IR 节点。使用 identity_transform! 回调重现提供的 phi_run 示例;当调用在没有当前错误的情况下完成,并且相关节点得到一致处理时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug

Ran into this while trying to reproduce another bug.
The following code errors:

using Diffractor
# this is needed as transform! is *always* called on Arguments regardless of what visit_custom says
identity_transform!(ir, ssa::Core.SSAValue, order) = ir[ssa]
function identity_transform!(ir, arg::Core.Argument, order)
    return Core.Compiler.insert_node!(ir, Core.SSAValue(1), Core.Compiler.NewInstruction(Expr(:call, Diffractor.ZeroBundle{1}, arg), Any))
end

function phi_run(x::Float64, b1::Bool, b2::Bool)
    if b1
        a = 0.
    elseif b2
        a = z
    end
    return x - a
end

input_ir = first(only(Base.code_ircode(phi_run, Tuple{Float64, Bool, Bool})))
Diffractor.forward_diff_no_inf!(copy(input_ir), Core.SSAValue.(1:length(input_ir.stmts)) .=> 1; transform! = identity_transform!)

I think the fix is easy, add the case to forward_visit about what to do for this kind of node.
Which i think is return nothing

主要语言
Julia
星标
453
派生
33
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaDiff/Diffractor.jl 的其他 Issue

查看 JuliaDiff/Diffractor.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。