Title: [248277] trunk/Source/WebCore
Revision
248277
Author
[email protected]
Date
2019-08-05 16:17:48 -0700 (Mon, 05 Aug 2019)

Log Message

[WHLSL] Add compile time flag to dump metal compile times
https://bugs.webkit.org/show_bug.cgi?id=200447

Reviewed by Myles C. Maxfield.

* Modules/webgpu/WHLSL/WHLSLPrepare.h:
* platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
(WebCore::trySetFunctions):
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::trySetFunctions):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248276 => 248277)


--- trunk/Source/WebCore/ChangeLog	2019-08-05 23:00:26 UTC (rev 248276)
+++ trunk/Source/WebCore/ChangeLog	2019-08-05 23:17:48 UTC (rev 248277)
@@ -1,3 +1,16 @@
+2019-08-05  Saam Barati  <[email protected]>
+
+        [WHLSL] Add compile time flag to dump metal compile times
+        https://bugs.webkit.org/show_bug.cgi?id=200447
+
+        Reviewed by Myles C. Maxfield.
+
+        * Modules/webgpu/WHLSL/WHLSLPrepare.h:
+        * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
+        (WebCore::trySetFunctions):
+        * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
+        (WebCore::trySetFunctions):
+
 2019-08-05  Chris Dumez  <[email protected]>
 
         navigator.geolocation wrapper should not become GC-collectable once its frame is detached

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.h (248276 => 248277)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.h	2019-08-05 23:00:26 UTC (rev 248276)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.h	2019-08-05 23:17:48 UTC (rev 248277)
@@ -36,6 +36,8 @@
 
 namespace WHLSL {
 
+constexpr bool dumpMetalCompileTimes = false;
+
 struct RenderPrepareResult {
     String metalSource;
     Metal::MangledFunctionName mangledVertexEntryPointName;

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm (248276 => 248277)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm	2019-08-05 23:00:26 UTC (rev 248276)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm	2019-08-05 23:17:48 UTC (rev 248277)
@@ -34,6 +34,8 @@
 #import "WHLSLPrepare.h"
 #import <Metal/Metal.h>
 #import <wtf/BlockObjCExceptions.h>
+#import <wtf/DataLog.h>
+#import <wtf/MonotonicTime.h>
 #import <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
@@ -85,7 +87,12 @@
         NSError *error = nil;
 
         BEGIN_BLOCK_OBJC_EXCEPTIONS;
+        MonotonicTime startTime;
+        if (WHLSL::dumpMetalCompileTimes)
+            startTime = MonotonicTime::now();
         computeLibrary = adoptNS([device.platformDevice() newLibraryWithSource:whlslCompileResult->metalSource options:nil error:&error]);
+        if (WHLSL::dumpMetalCompileTimes)
+            dataLogLn("Metal compile times: ", (MonotonicTime::now() - startTime).milliseconds(), " ms");
         END_BLOCK_OBJC_EXCEPTIONS;
 #ifndef NDEBUG
         if (!computeLibrary)

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (248276 => 248277)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-08-05 23:00:26 UTC (rev 248276)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-08-05 23:17:48 UTC (rev 248277)
@@ -37,7 +37,9 @@
 #import <Metal/Metal.h>
 #import <wtf/BlockObjCExceptions.h>
 #import <wtf/CheckedArithmetic.h>
+#import <wtf/DataLog.h>
 #import <wtf/HashSet.h>
+#import <wtf/MonotonicTime.h>
 #import <wtf/OptionSet.h>
 #import <wtf/Optional.h>
 #import <wtf/text/StringConcatenate.h>
@@ -397,7 +399,12 @@
         NSError *error = nil;
 
         BEGIN_BLOCK_OBJC_EXCEPTIONS;
+        MonotonicTime startTime;
+        if (WHLSL::dumpMetalCompileTimes)
+            startTime = MonotonicTime::now();
         vertexLibrary = adoptNS([device.platformDevice() newLibraryWithSource:whlslCompileResult->metalSource options:nil error:&error]);
+        if (WHLSL::dumpMetalCompileTimes)
+            dataLogLn("Metal compile times: ", (MonotonicTime::now() - startTime).milliseconds(), " ms");
         END_BLOCK_OBJC_EXCEPTIONS;
 
         if (!vertexLibrary && error) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to