Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run "src/webgpu" tests within a React Native app #1

Merged
merged 16 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,22 @@ $RECYCLE.BIN/
trace/

# End of https://www.gitignore.io/api/linux,macos,windows,node


# React Native Test App
*.binlog
*.hprof
*.xcworkspace/
*.zip
.DS_Store
.gradle/
.idea/
.vs/
.xcode.env
Pods/
build/
dist/*
!dist/.gitignore
local.properties
msbuild.binlog
node_modules/
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# WebGPU Conformance Test Suite
# React Native WebGPU Conformance Test Suite

This is the conformance test suite for WebGPU.
It tests the behaviors defined by the [WebGPU specification](https://gpuweb.github.io/gpuweb/).
This is the conformance test suite for React Native WebGPU.
It tests the behaviors defined by the [WebGPU specification](https://gpuweb.github.io/gpuweb/). This repository is forked from the [WebGPU CTS](https://github.com/gpuweb/cts) and currently targets the `react-native-wgpu` library. In the future, we hope to support any WebGPU-compliant React Native module.

The contents of this test suite are considered **normative**; implementations must pass
them to be WebGPU-conformant. Mismatches between the specification and tests are bugs.

This test suite can be embedded inside [WPT](https://github.com/web-platform-tests/wpt) or run in standalone.
## Building and running the Test Suite

## [Launch the standalone CTS runner / test plan viewer](https://gpuweb.github.io/cts/standalone/)
To install dependencies for the conformance test suite, run the following command:

```
npm install
```

The React Native portion of this test suite is built on top of [React Native Test App](https://github.com/microsoft/react-native-test-app). Build instructions for your target platform can be found here: https://github.com/microsoft/react-native-test-app/wiki/Quick-Start#platform-specific-instructions. The conformance test suite targets Hermes by default.

To run tests, click the "Run Tests" button on the app homepage. Once tests complete, the app will generate a summary of failed and skipped tests, along with a list of all tests that failed. The tests will take a few minutes to run. A log of the current running test can be viewed in the Metro console.

## `react-native-wgpu` inventory

For the `react-native-wgpu` library, there are a few blockers for generating a full inventory of tests passing. Here are the test suites that currently crash or hang:

- `webgpu/api/operation/adapter`: Main thread hangs on a promise await. See: https://github.com/wcandillon/react-native-webgpu/issues/126
- `webgpu/api/operation/buffers`: `map.spec` and `map_oom.spec` have tests that crash when trying to allocate a buffer. `remapped_for_write`, `mappedAtCreation,mapState`, `mapAsync,mapState`, `mappedAtCreation`.
- `webgpu/api/operation/memory_sync`: The "either" interpolation option is not supported, causing shader compilation to crash. Shader compilation crashes should likely not crash the app.
- `webgpu/api/operation/render_pipeline`: Tests crash with an unknown error.
- `webgpu/api/operation/rendering`: Same as `memory_sync` tests.
- `webgpu/api/operation/shader_module`: Different shader compilation issue.
- `webgpu/api/operation/storage_texture`: Same as `memory_sync` tests.
- `webgpu/api/operation/vertex_state`: Same as `memory_sync` tests.

## Contributing

Expand Down
43 changes: 43 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
buildscript {
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())

repositories {
mavenCentral()
google()
}

dependencies {
getReactNativeDependencies().each { dependency ->
classpath(dependency)
}
}
}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url({
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native/android")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native`");
}())
}
mavenCentral()
google()
}
}
53 changes: 53 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the Gradle Daemon. The setting is
# particularly useful for configuring JVM memory settings for build performance.
# This does not affect the JVM settings for the Gradle client VM.
# The default is `-Xmx512m -XX:MaxMetaspaceSize=256m`.
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute
# projects in parallel. To learn more about parallel task execution, see the
# section on Gradle build performance:
# https://docs.gradle.org/current/userguide/performance.html#parallel_execution.
# Default is `false`.
#org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Jetifier randomly fails on these libraries
android.jetifier.ignorelist=hermes-android,react-android

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
# Note that this is incompatible with web debugging.
#newArchEnabled=true
#bridgelessEnabled=true

# Uncomment the line below to build React Native from source.
#react.buildFromSource=true

# Version of Android NDK to build against.
#ANDROID_NDK_VERSION=26.1.10909125

# Version of Kotlin to build against.
#KOTLIN_VERSION=1.8.22
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading