{"id":827,"date":"2023-01-20T12:05:08","date_gmt":"2023-01-20T03:05:08","guid":{"rendered":"https:\/\/blogs.igalia.com\/gyuyoung\/?p=827"},"modified":"2023-01-20T12:05:08","modified_gmt":"2023-01-20T03:05:08","slug":"webgpu-conformance-test-suite","status":"publish","type":"post","link":"https:\/\/blogs.igalia.com\/gyuyoung\/2023\/01\/20\/webgpu-conformance-test-suite\/","title":{"rendered":"WebGPU Conformance Test Suite"},"content":{"rendered":"\n\n<h2 class=\"wp-block-heading\"><strong>WebGPU<\/strong> Introduction<\/h2>\n\n\n\n\nWebGPU is a new Web API that exposes modern computer graphics capabilities, specifically Direct3D 12, Metal, and Vulkan, for performing rendering and computation operations on a GPU. This goal is similar to the <a href=\"https:\/\/developer.mozilla.org\/docs\/Web\/API\/WebGL_API\">WebGL<\/a> family of APIs, but WebGPU enables access to more advanced features of GPUs. Whereas WebGL is mostly for drawing images but can be repurposed (with great effort) for other kinds of computations, WebGPU provides first-class support for performing general computations on the GPU.&nbsp;\n\n\n\nIn other words, the WebGPU API is the successor to the WebGL and WebGL2 graphics APIs for the Web. It provides modern features such as \u201cGPU compute\u201d as well as lower overhead access to GPU hardware and better, more predictable performance. The below picture shows the WebGPU architecture diagram simply.[1]<br>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"331\" src=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2022\/12\/image.png\" alt=\"\" class=\"wp-image-828\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2022\/12\/image.png 845w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2022\/12\/image-300x118.png 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2022\/12\/image-768x301.png 768w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2022\/12\/image-624x244.png 624w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/figure>\n\n\n\n\n<h2 class=\"wp-block-heading\"><strong>WebGPU CTS<\/strong><\/h2>\n\n\n\n\nThere is currently a CTS (Conformance Test Suites) that tests the behaviors defined by the WebGPU specification. The CTS has been written in TypeScript and developed in<a href=\"https:\/\/github.com\/gpuweb\/cts\"> GitHub<\/a>, and the CTS can be run with a sort of &#8216;adapter layer&#8217; to work under other test infrastructures like WPT and Telemetry. At this point, there are around 1,400 tests that check the validation and operation of WebGPU implementations.\n\n\n\nThere is a site to run the WebGPU CTS. If you go to the URL below with a browser that enables the WebGPU feature, you can run the CTS on your browser.\n\n\n\n<em><a href=\"blank\"> https:\/\/gpuweb.github.io\/cts\/standalone\/?runnow=0&amp;worker=0&amp;debug=0&amp;q=webgpu:<\/a><\/em><br>\n\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Contribution<\/strong><\/h2>\n\n\n\n\nThe WebGPU CTS has progressed in GitHub. If you want to contribute to the CTS project, you can start by taking a look at the <a href=\"https:\/\/github.com\/orgs\/gpuweb\/projects\/3\">issues<\/a> that have been filed. Please follow the sequence below:\n\n\n\n\n<ol class=\"wp-block-list\"><li>Set up the CTS developing environment.<\/li><li>Add to or edit the test plan in the CTS project site.<\/li><li>Implement the test.<\/li><li>Upload the test and request a review.<\/li><\/ol>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Organization<\/h2>\n\n\n\n\nThe CTS is largely composed of four categories &#8211; <strong>API<\/strong>, <strong>Shader<\/strong>, <strong>IDL<\/strong>, and <strong>Web Platform<\/strong>. First, the<strong> API<\/strong> category tests full coverage of the Javascript API surface of WebGPU. The <strong>Shader<\/strong> category tests the full coverage of the shaders that can be passed to WebGPU. The <strong>IDL<\/strong> category checks that the WebGPU IDL is correctly implemented. Lastly, the <strong>Web Platform<\/strong> category tests WebPlatform-specific interactions.\n\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n\nThis is a simple<a href=\"https:\/\/source.chromium.org\/chromium\/chromium\/src\/+\/main:third_party\/webgpu-cts\/src\/src\/webgpu\/api\/validation\/queue\/writeBuffer.spec.ts;l=20?q=Test%20that%20the%20buffer%20used%20for%20GPUQueue.writeBuffer()%20must%20be%20valid.%20Tests%20calling%20writeBuffer&amp;ss=chromium\"> test<\/a> for checking writeBuffer function validation. Basically, a general test consists of three blocks like <strong>description<\/strong>, <strong>parameters<\/strong>, and <strong>function body<\/strong>.\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"380\" src=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image.png\" alt=\"\" class=\"wp-image-831\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image.png 613w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-300x186.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/figure>\n\n\n\n\n<ul class=\"wp-block-list\"><li>desc: Describes what it tests and summarize how it tests that functionality.<\/li><li>params: Defines parameters with a list of objects to be tested. Each such instance of the test is a &#8220;case&#8221;<\/li><li>fn: Implementation body of the test.<\/li><\/ul>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Parameterization<\/h2>\n\n\n\n\nLet&#8217;s take a look at the parameterization a bit deeper. The CTS provides helpers like params() and others for creating large Cartesian products of test parameters. These generate &#8220;test cases&#8221; further subdivided into &#8220;test subcases&#8221;. Thanks to the parameterization support, we can test with more varied input values.\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"542\" src=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-2.png\" alt=\"\" class=\"wp-image-833\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-2.png 646w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-2-300x252.png 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-2-624x524.png 624w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/figure>\n\n\n\n\n<h2 class=\"wp-block-heading\">Contributors<\/h2>\n\n\n\n\nThe WebGPU CTS has been developed by several contributors. Google (let&#8217;s assume that chromium.org is Google) has been writing most of the test cases. After that, Intel, gmail.com, and Igalia have contributed to the CTS tests.\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/9Q-9afNlNX6pSHn6vOmUo_5lTSfGtRKkKFIdju3I4VIoQRV4R1rh6xxYTJ7oSdkIJXtLBEEOe9XRNjGhz8wBh7Yv_oAMmhzRa053sSBGwSmvDHVztNkR8JdLDnigJtFZ9Bo2jc4Q3LEQ_7U5k2KsQPIOKw=s2048\" alt=\"\" \/><\/figure>\n\n\n\nThis table shows the commit count of the main contributors, classified by email accounts. As you can see in the table, Google and Intel are the main contributors to the WebGPU CTS. Igalia has also participated in the CTS project since June 2022, and has written test cases for checking the validity of the texture format and copy functionality as well as the operation of the index format and the depth\/stencil state.\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"362\" src=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-3.png\" alt=\"\" class=\"wp-image-834\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-3.png 494w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2023\/01\/image-3-300x220.png 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/figure>\n\n\n\n\n<h2 class=\"wp-block-heading\">The next steps<\/h2>\n\n\n\n\nThe Chromium WebGPU team announced their plan via an<a href=\"https:\/\/groups.google.com\/a\/chromium.org\/g\/blink-dev\/c\/VomzPhvJCxI\/m\/SUhU9Z0vAgAJ\"> intent-to-ship<\/a> posted to blink-dev recently. The Origin Trial for WebGPU expires starting in M110 and they aim to ship the WebGPU feature to Chromium in M113.\n\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n\n[1] <a href=\"https:\/\/developer.chrome.com\/en\/docs\/web-platform\/webgpu\/\">https:\/\/developer.chrome.com\/en\/docs\/web-platform\/webgpu\/<\/a>\n\n\n\n<br>\n","protected":false},"excerpt":{"rendered":"<p>WebGPU Introduction WebGPU is a new Web API that exposes modern computer graphics capabilities, specifically Direct3D 12, Metal, and Vulkan, for performing rendering and computation operations on a GPU. This goal is similar to the WebGL family of APIs, but WebGPU enables access to more advanced features of GPUs. Whereas WebGL is mostly for drawing [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-827","post","type-post","status-publish","format-standard","hentry","category-igalia-chromium"],"_links":{"self":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/comments?post=827"}],"version-history":[{"count":13,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/827\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/827\/revisions\/847"}],"wp:attachment":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/media?parent=827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/categories?post=827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/tags?post=827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}