Skip to content

Commit

Permalink
Deploying to gh-pages from @ ce8c3f8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jul 7, 2023
1 parent 4f9fb55 commit 32d1a98
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 54 deletions.
2 changes: 1 addition & 1 deletion api/source-files.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions api/src/rustc_codegen_spirv/builder/builder_methods.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2676,7 +2676,6 @@
<a href="#2676" id="2676">2676</a>
<a href="#2677" id="2677">2677</a>
<a href="#2678" id="2678">2678</a>
<a href="#2679" id="2679">2679</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::Builder;
<span class="kw">use </span><span class="kw">crate</span>::abi::ConvSpirvType;
<span class="kw">use </span><span class="kw">crate</span>::builder_spirv::{BuilderCursor, SpirvConst, SpirvValue, SpirvValueExt, SpirvValueKind};
Expand Down Expand Up @@ -5136,8 +5135,7 @@
<span class="kw">let </span>is_standard_debug = [Op::Line, Op::NoLine].contains(<span class="kw-2">&amp;</span>inst.class.opcode);
<span class="kw">let </span>is_custom_debug = inst.class.opcode == Op::ExtInst
&amp;&amp; inst.operands[<span class="number">0</span>].unwrap_id_ref() == custom_ext_inst_set_import
&amp;&amp; [CustomOp::SetDebugSrcLoc, CustomOp::ClearDebugSrcLoc]
.contains(<span class="kw-2">&amp;</span>CustomOp::decode_from_ext_inst(inst));
&amp;&amp; CustomOp::decode_from_ext_inst(inst).is_debuginfo();
!(is_standard_debug || is_custom_debug)
});

Expand Down
22 changes: 13 additions & 9 deletions api/src/rustc_codegen_spirv/builder/intrinsics.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,13 @@
<a href="#380" id="380">380</a>
<a href="#381" id="381">381</a>
<a href="#382" id="382">382</a>
<a href="#383" id="383">383</a>
<a href="#384" id="384">384</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::Builder;
<span class="kw">use </span><span class="kw">crate</span>::abi::ConvSpirvType;
<span class="kw">use </span><span class="kw">crate</span>::builder_spirv::{SpirvValue, SpirvValueExt};
<span class="kw">use </span><span class="kw">crate</span>::codegen_cx::CodegenCx;
<span class="kw">use </span><span class="kw">crate</span>::custom_insts::CustomInst;
<span class="kw">use </span><span class="kw">crate</span>::spirv_type::SpirvType;
<span class="kw">use </span>rspirv::spirv::GLOp;
<span class="kw">use </span>rustc_codegen_ssa::mir::operand::OperandRef;
Expand Down Expand Up @@ -719,17 +722,18 @@
}

<span class="kw">fn </span>abort(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
<span class="comment">// HACK(eddyb) there is no `abort` or `trap` instruction in SPIR-V,
// so the best thing we can do is inject an infinite loop.
// (While there is `OpKill`, it doesn&#39;t really have the right semantics)
</span><span class="kw">let </span>abort_loop_bb = <span class="self">self</span>.append_sibling_block(<span class="string">&quot;abort_loop&quot;</span>);
<span class="kw">let </span>abort_continue_bb = <span class="self">self</span>.append_sibling_block(<span class="string">&quot;abort_continue&quot;</span>);
<span class="self">self</span>.br(abort_loop_bb);
<span class="comment">// FIXME(eddyb) this should be cached more efficiently.
</span><span class="kw">let </span>void_ty = SpirvType::Void.def(rustc_span::DUMMY_SP, <span class="self">self</span>);

<span class="self">self</span>.switch_to_block(abort_loop_bb);
<span class="self">self</span>.br(abort_loop_bb);
<span class="comment">// HACK(eddyb) there is no `abort` or `trap` instruction in SPIR-V,
// so the best thing we can do is use our own custom instruction.
</span><span class="self">self</span>.custom_inst(void_ty, CustomInst::Abort);
<span class="self">self</span>.unreachable();

<span class="self">self</span>.switch_to_block(abort_continue_bb);
<span class="comment">// HACK(eddyb) we still need an active block in case the user of this
// `Builder` will continue to emit instructions after the `.abort()`.
</span><span class="kw">let </span>post_abort_dead_bb = <span class="self">self</span>.append_sibling_block(<span class="string">&quot;post_abort_dead&quot;</span>);
<span class="self">self</span>.switch_to_block(post_abort_dead_bb);
}

<span class="kw">fn </span>assume(<span class="kw-2">&amp;mut </span><span class="self">self</span>, _val: <span class="self">Self</span>::Value) {
Expand Down
2 changes: 1 addition & 1 deletion api/src/rustc_codegen_spirv/codegen_cx/mod.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@

<span class="doccomment">/// All `panic!(...)`s and builtin panics (from MIR `Assert`s) call into one
/// of these lang items, which we always replace with an &quot;abort&quot;, erasing
/// anything passed in (and that &quot;abort&quot; is just an infinite loop for now).
/// anything passed in.
</span><span class="comment">//
// FIXME(eddyb) we should not erase anywhere near as much, but `format_args!`
// is not representable due to containg Rust slices, and Rust 2021 has made
Expand Down
102 changes: 102 additions & 0 deletions api/src/rustc_codegen_spirv/custom_insts.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,57 @@
<a href="#126" id="126">126</a>
<a href="#127" id="127">127</a>
<a href="#128" id="128">128</a>
<a href="#129" id="129">129</a>
<a href="#130" id="130">130</a>
<a href="#131" id="131">131</a>
<a href="#132" id="132">132</a>
<a href="#133" id="133">133</a>
<a href="#134" id="134">134</a>
<a href="#135" id="135">135</a>
<a href="#136" id="136">136</a>
<a href="#137" id="137">137</a>
<a href="#138" id="138">138</a>
<a href="#139" id="139">139</a>
<a href="#140" id="140">140</a>
<a href="#141" id="141">141</a>
<a href="#142" id="142">142</a>
<a href="#143" id="143">143</a>
<a href="#144" id="144">144</a>
<a href="#145" id="145">145</a>
<a href="#146" id="146">146</a>
<a href="#147" id="147">147</a>
<a href="#148" id="148">148</a>
<a href="#149" id="149">149</a>
<a href="#150" id="150">150</a>
<a href="#151" id="151">151</a>
<a href="#152" id="152">152</a>
<a href="#153" id="153">153</a>
<a href="#154" id="154">154</a>
<a href="#155" id="155">155</a>
<a href="#156" id="156">156</a>
<a href="#157" id="157">157</a>
<a href="#158" id="158">158</a>
<a href="#159" id="159">159</a>
<a href="#160" id="160">160</a>
<a href="#161" id="161">161</a>
<a href="#162" id="162">162</a>
<a href="#163" id="163">163</a>
<a href="#164" id="164">164</a>
<a href="#165" id="165">165</a>
<a href="#166" id="166">166</a>
<a href="#167" id="167">167</a>
<a href="#168" id="168">168</a>
<a href="#169" id="169">169</a>
<a href="#170" id="170">170</a>
<a href="#171" id="171">171</a>
<a href="#172" id="172">172</a>
<a href="#173" id="173">173</a>
<a href="#174" id="174">174</a>
<a href="#175" id="175">175</a>
<a href="#176" id="176">176</a>
<a href="#177" id="177">177</a>
<a href="#178" id="178">178</a>
<a href="#179" id="179">179</a>
</pre></div><pre class="rust"><code><span class="doccomment">//! SPIR-V (extended) instructions specific to `rustc_codegen_spirv`, produced
//! during the original codegen of a crate, and consumed by the `linker`.

Expand Down Expand Up @@ -253,5 +304,56 @@
<span class="comment">// Leave the most recent inlined call frame entered by a `PushInlinedCallFrame`
// (i.e. the inlined call frames form a virtual call stack in debuginfo).
</span><span class="number">3 </span>=&gt; PopInlinedCallFrame,

<span class="comment">// [Semantic] Similar to some proposed `OpAbort`, but without any ability to
// indicate abnormal termination (so it&#39;s closer to `OpTerminateInvocation`,
// which we could theoretically use, but that&#39;s limited to fragment shaders).
//
// Lowering takes advantage of inlining happening before CFG structurization
// (by forcing inlining of `Abort`s all the way up to entry-points, as to be
// able to turn the `Abort`s into regular `OpReturn`s, from an entry-point),
// but if/when inlining works on structured SPIR-T instead, it&#39;s not much
// harder to make any call to a &quot;may (transitively) abort&quot; function branch on
// an additional returned `bool`, instead (i.e. a form of emulated unwinding).
//
// As this is a custom terminator, it must only appear before `OpUnreachable`,
// *without* any instructions in between (not even debuginfo ones).
//
// FIXME(eddyb) long-term this kind of custom control-flow could be generalized
// to fully emulate unwinding (resulting in codegen similar to `?` in functions
// returning `Option` or `Result`), to e.g. run destructors, or even allow
// users to do `catch_unwind` at the top-level of their shader to handle
// panics specially (e.g. by appending to a custom buffer, or using some
// specific color in a fragment shader, to indicate a panic happened).
</span><span class="number">4 </span>=&gt; Abort,
}

<span class="kw">impl </span>CustomOp {
<span class="doccomment">/// Returns `true` iff this `CustomOp` is a custom debuginfo instruction,
/// i.e. non-semantic (can/must be ignored wherever `OpLine`/`OpNoLine` are).
</span><span class="kw">pub fn </span>is_debuginfo(<span class="self">self</span>) -&gt; bool {
<span class="kw">match </span><span class="self">self </span>{
CustomOp::SetDebugSrcLoc
| CustomOp::ClearDebugSrcLoc
| CustomOp::PushInlinedCallFrame
| CustomOp::PopInlinedCallFrame =&gt; <span class="bool-val">true</span>,

CustomOp::Abort =&gt; <span class="bool-val">false</span>,
}
}

<span class="doccomment">/// Returns `true` iff this `CustomOp` is a custom terminator instruction,
/// i.e. semantic and must always appear just before an `OpUnreachable`
/// standard terminator (without even debuginfo in between the two).
</span><span class="kw">pub fn </span>is_terminator(<span class="self">self</span>) -&gt; bool {
<span class="kw">match </span><span class="self">self </span>{
CustomOp::SetDebugSrcLoc
| CustomOp::ClearDebugSrcLoc
| CustomOp::PushInlinedCallFrame
| CustomOp::PopInlinedCallFrame =&gt; <span class="bool-val">false</span>,

CustomOp::Abort =&gt; <span class="bool-val">true</span>,
}
}
}
</code></pre></div></section></main></body></html>
Loading

0 comments on commit 32d1a98

Please sign in to comment.