Changeset 249787 in webkit
- Timestamp:
- Sep 11, 2019 4:34:42 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249786 r249787 1 2019-09-11 Saam Barati <sbarati@apple.com> 2 3 [WHLSL] Ensure structs/arrays with pointers as fields are disallowed 4 https://bugs.webkit.org/show_bug.cgi?id=201525 5 6 Reviewed by Robin Morisset. 7 8 This patch fixes a bug in our test harness where we forgot to wait for the gpu 9 device to load before running test harness tests. This patch fixes this oversight 10 and asserts that we have always finished loading before running a test. 11 12 * webgpu/whlsl/array-spec-tests.html: 13 * webgpu/whlsl/ensure-proper-pointer-usage-expected.txt: Added. 14 * webgpu/whlsl/ensure-proper-pointer-usage.html: Added. 15 * webgpu/whlsl/js/test-harness.js: 16 (Harness): 17 (Harness.prototype.async.requestDevice): 18 (Harness.prototype.async.callTypedFunction): 19 (Harness.prototype.async.checkCompileFail): 20 * webgpu/whlsl/pointer-spec-tests.html: 21 * webgpu/whlsl/test-harness-test.html: 22 1 23 2019-09-11 Devin Rousso <drousso@apple.com> 2 24 -
trunk/LayoutTests/webgpu/whlsl/array-spec-tests.html
r249765 r249787 30 30 } 31 31 `; 32 a ssert_equals(await callIntFunction(program, "foo", []), 76 + 39 + 83);32 await checkFail(program); 33 33 } 34 34 -
trunk/LayoutTests/webgpu/whlsl/js/test-harness.js
r249765 r249787 159 159 constructor () 160 160 { 161 this._loaded = false; 161 162 } 162 163 … … 170 171 // FIXME: Add support for GPUAdapterRequestOptions and GPUDeviceDescriptor, 171 172 // and differentiate between descriptor validation errors and no WebGPU support. 173 } finally { 174 this._loaded = true; 172 175 } 173 176 } … … 183 186 async callTypedFunction(type, functions, name, args) 184 187 { 188 if (!this._loaded) 189 throw new Error("GPU device not loaded."); 190 185 191 if (this._device === undefined) 186 192 throw new WebGPUUnsupportedError(); … … 264 270 async checkCompileFail(source) 265 271 { 272 if (!this._loaded) 273 throw new Error("GPU device not loaded."); 274 266 275 if (this._device === undefined) 267 return;276 throw new WebGPUUnsupportedError(); 268 277 269 278 let entryPointCode = ` … … 520 529 function runTests(obj) { 521 530 window.addEventListener("load", async () => { 531 await harness.requestDevice(); 522 532 try { 523 533 for (const name in obj) { -
trunk/LayoutTests/webgpu/whlsl/pointer-spec-tests.html
r249765 r249787 30 30 return result; 31 31 } 32 `; ;33 a ssert_equals(await callIntFunction(program, "foo", []), 76 + 39 + 83);32 `; 33 await checkFail(program); 34 34 } 35 35 -
trunk/LayoutTests/webgpu/whlsl/test-harness-test.html
r249765 r249787 187 187 }; 188 188 189 window.addEventListener("load", () => {189 window.addEventListener("load", async () => { 190 190 try { 191 await harness.requestDevice(); 191 192 for (const name in whlslTests) { 192 193 if (!name.startsWith("_")) -
trunk/Source/WebCore/ChangeLog
r249786 r249787 1 2019-09-11 Saam Barati <sbarati@apple.com> 2 3 [WHLSL] Ensure structs/arrays with pointers as fields are disallowed 4 https://bugs.webkit.org/show_bug.cgi?id=201525 5 6 Reviewed by Robin Morisset. 7 8 This patch adds a pass which both ensures that references are always initialized with 9 concrete values and that we support logical mode validation by disallowing nested references. 10 11 Specifically, the pass: 12 13 1. Disallows structs to have fields which are references. This prevents us from having to 14 figure out how to default initialize such a struct. We could relax this in the future if we 15 did an analysis on which structs contain reference fields, and ensure such struct variables 16 always have initializers. This would also require us to create constructors for structs which 17 initialize each field. 18 2. We also do the same for arrays. 19 3. References can only be one level deep. So no pointers to pointers. No references to 20 references, etc. This is to support logical mode validation rules. 21 22 Test: webgpu/whlsl/ensure-proper-pointer-usage.html 23 24 * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: Added. 25 (WebCore::WHLSL::checkReferenceTypes): 26 * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: Added. 27 * Modules/webgpu/WHLSL/WHLSLChecker.cpp: 28 (WebCore::WHLSL::Checker::visit): 29 * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: 30 (WebCore::WHLSL::prepareShared): 31 * Sources.txt: 32 * WebCore.xcodeproj/project.pbxproj: 33 1 34 2019-09-11 Devin Rousso <drousso@apple.com> 2 35 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp
r249765 r249787 937 937 if (is<AST::PointerType>(unnamedType)) { 938 938 auto& pointerType = downcast<AST::PointerType>(unnamedType); 939 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198163 Save the fact that we're not targetting the item; we're targetting the item's inner element.940 939 assignConcreteType(makeArrayReferenceExpression, AST::ArrayReferenceType::create(makeArrayReferenceExpression.codeLocation(), pointerType.addressSpace(), pointerType.elementType())); 941 940 return; -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp
r249765 r249787 31 31 #include "WHLSLASTDumper.h" 32 32 #include "WHLSLCheckDuplicateFunctions.h" 33 #include "WHLSLCheckReferenceTypes.h" 33 34 #include "WHLSLCheckTextureReferences.h" 34 35 #include "WHLSLChecker.h" … … 232 233 RUN_PASS(checkLiteralTypes, program); 233 234 CHECK_PASS(checkTextureReferences, program); 235 CHECK_PASS(checkReferenceTypes, program); 234 236 RUN_PASS(resolveProperties, program); 235 237 RUN_PASS(findHighZombies, program); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp
r249351 r249787 31 31 #include "WHLSLAST.h" 32 32 #include "WHLSLProgram.h" 33 #include "WHLSLVisitor.h" 33 34 34 35 namespace WebCore { -
trunk/Source/WebCore/Sources.txt
r249765 r249787 314 314 Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp 315 315 Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp 316 Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp 316 317 Modules/webgpu/WHLSL/WHLSLChecker.cpp 317 318 Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r249765 r249787 8332 8332 522E1A172297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLPreserveVariableLifetimes.cpp; sourceTree = "<group>"; }; 8333 8333 522E1A192297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLPreserveVariableLifetimes.h; sourceTree = "<group>"; }; 8334 524BD47E23277E15008F56C1 /* WHLSLCheckReferenceTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLCheckReferenceTypes.cpp; sourceTree = "<group>"; }; 8335 524BD48023277E16008F56C1 /* WHLSLCheckReferenceTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLCheckReferenceTypes.h; sourceTree = "<group>"; }; 8334 8336 526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextTrackRepresentationCocoa.mm; sourceTree = "<group>"; }; 8335 8337 526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentationCocoa.h; sourceTree = "<group>"; }; … … 25580 25582 1C281C6D22B87B9800691C00 /* WHLSLCheckTextureReferences.cpp */, 25581 25583 1C281C6E22B87B9800691C00 /* WHLSLCheckTextureReferences.h */, 25584 524BD47E23277E15008F56C1 /* WHLSLCheckReferenceTypes.cpp */, 25585 524BD48023277E16008F56C1 /* WHLSLCheckReferenceTypes.h */, 25582 25586 522BAB9622E6A36200C54CE9 /* WHLSLCodeLocation.h */, 25583 25587 1C86CA4B22AA19FF001BF961 /* WHLSLComputeDimensions.cpp */,
Note: See TracChangeset
for help on using the changeset viewer.