|
185 | 185 | <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> |
186 | 186 | </button> |
187 | 187 | </div> |
188 | | - <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc"> |
| 188 | + <label class="toc-overlay-icon toc-header-icon" for="__toc"> |
189 | 189 | <span class="icon"><svg><use href="#svg-toc"></use></svg></span> |
190 | 190 | </label> |
191 | 191 | </div> |
|
615 | 615 | <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> |
616 | 616 | </button> |
617 | 617 | </div> |
618 | | - <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc"> |
| 618 | + <label class="toc-overlay-icon toc-content-icon" for="__toc"> |
619 | 619 | <span class="icon"><svg><use href="#svg-toc"></use></svg></span> |
620 | 620 | </label> |
621 | 621 | </div> |
|
668 | 668 | </tbody> |
669 | 669 | </table> |
670 | 670 | </div> |
| 671 | +<section id="module-dpctl.program.utils"> |
| 672 | +<span id="dpctl-program-utils"></span><h2><a class="reference internal" href="#module-dpctl.program.utils" title="dpctl.program.utils"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpctl.program.utils</span></code></a><a class="headerlink" href="#module-dpctl.program.utils" title="Permalink to this heading">¶</a></h2> |
| 673 | +<dl class="py function"> |
| 674 | +<dt class="sig sig-object py" id="dpctl.program.utils.parse_spirv_specializations"> |
| 675 | +<span class="sig-prename descclassname"><span class="pre">dpctl.program.utils.</span></span><span class="sig-name descname"><span class="pre">parse_spirv_specializations</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">spv_bytes</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.14)"><span class="pre">bytes</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(in Python v3.14)"><span class="pre">bytearray</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#memoryview" title="(in Python v3.14)"><span class="pre">memoryview</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.14)"><span class="pre">tuple</span></a><span class="p"><span class="pre">[</span></span><span class="pre">dpctl.program.utils._utils.SpecializationConstantInfo</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../../_modules/dpctl/program/utils/_utils.html#parse_spirv_specializations"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dpctl.program.utils.parse_spirv_specializations" title="Permalink to this definition">¶</a></dt> |
| 676 | +<dd><p>Parses SPIR-V byte stream to extract information about specializations, |
| 677 | +including the specialization IDs, types, names, and default values.</p> |
| 678 | +<p>Note that the dtype information may be imprecise, as the compiler may |
| 679 | +choose to, for example, represent a bool as char, or may represent both |
| 680 | +signed and unsigned integers as unsigned integer bit buckets of the same |
| 681 | +length.</p> |
| 682 | +<dl class="field-list simple"> |
| 683 | +<dt class="field-odd">Parameters<span class="colon">:</span></dt> |
| 684 | +<dd class="field-odd"><p><strong>spv_bytes</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.14)"><em>bytes</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytearray" title="(in Python v3.14)"><em>bytearray</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#memoryview" title="(in Python v3.14)"><em>memoryview</em></a>) – the SPIR-V byte stream.</p> |
| 685 | +</dd> |
| 686 | +<dt class="field-even">Returns<span class="colon">:</span></dt> |
| 687 | +<dd class="field-even"><p><p>a tuple of parsed constants and their information represented by |
| 688 | +<cite>SpecializationConstantInfo</cite> objects, sorted by their |
| 689 | +specialization IDs. The length of the tuple is equal to the number |
| 690 | +of specialization constants found. Each |
| 691 | +<cite>SpecializationConstantInfo</cite> object contains the following |
| 692 | +attributes:</p> |
| 693 | +<ul class="simple"> |
| 694 | +<li><p><cite>spec_id</cite> (int): The specialization ID.</p></li> |
| 695 | +<li><p><cite>dtype</cite> (str): A NumPy style string representing the data type.</p></li> |
| 696 | +<li><dl class="simple"> |
| 697 | +<dt><cite>itemsize</cite> (int): The size of the specialization constant in</dt><dd><p>bytes.</p> |
| 698 | +</dd> |
| 699 | +</dl> |
| 700 | +</li> |
| 701 | +<li><dl class="simple"> |
| 702 | +<dt><cite>name</cite> (str): The variable name. If not preserved in the binary,</dt><dd><p>a default name in the format <cite>unnamed_spec_const_{spec_id}</cite> is |
| 703 | +used.</p> |
| 704 | +</dd> |
| 705 | +</dl> |
| 706 | +</li> |
| 707 | +<li><dl class="simple"> |
| 708 | +<dt><cite>default_value</cite> (int | float | bool | None): The default value of</dt><dd><p>the specialization constant. If not specified, <cite>None</cite> is used.</p> |
| 709 | +</dd> |
| 710 | +</dl> |
| 711 | +</li> |
| 712 | +</ul> |
| 713 | +</p> |
| 714 | +</dd> |
| 715 | +<dt class="field-odd">Return type<span class="colon">:</span></dt> |
| 716 | +<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.14)">tuple</a>[SpecializationConstantInfo]</p> |
| 717 | +</dd> |
| 718 | +</dl> |
| 719 | +</dd></dl> |
| 720 | + |
| 721 | +</section> |
671 | 722 | </section> |
672 | 723 |
|
673 | 724 | </article> |
|
713 | 764 |
|
714 | 765 | </footer> |
715 | 766 | </div> |
716 | | - <aside class="toc-drawer no-toc"> |
| 767 | + <aside class="toc-drawer"> |
717 | 768 |
|
718 | 769 |
|
| 770 | + <div class="toc-sticky toc-scroll"> |
| 771 | + <div class="toc-title-container"> |
| 772 | + <span class="toc-title"> |
| 773 | + On this page |
| 774 | + </span> |
| 775 | + </div> |
| 776 | + <div class="toc-tree-container"> |
| 777 | + <div class="toc-tree"> |
| 778 | + <ul> |
| 779 | +<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpctl.program</span></code></a><ul> |
| 780 | +<li><a class="reference internal" href="#module-dpctl.program.utils"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpctl.program.utils</span></code></a><ul> |
| 781 | +<li><a class="reference internal" href="#dpctl.program.utils.parse_spirv_specializations"><code class="docutils literal notranslate"><span class="pre">parse_spirv_specializations()</span></code></a></li> |
| 782 | +</ul> |
| 783 | +</li> |
| 784 | +</ul> |
| 785 | +</li> |
| 786 | +</ul> |
| 787 | + |
| 788 | + </div> |
| 789 | + </div> |
| 790 | + </div> |
| 791 | + |
719 | 792 |
|
720 | 793 | </aside> |
721 | 794 | </div> |
|
0 commit comments