@simulatte/webgpu-doe 0.1.2 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/LICENSE +191 -0
- package/README.md +121 -126
- package/assets/fawn-icon-main.svg +222 -0
- package/examples/with-webgpu-compute.js +25 -0
- package/package.json +31 -26
- package/src/index.d.ts +125 -0
- package/src/index.js +644 -408
- package/binding.gyp +0 -20
- package/native/doe_napi.c +0 -1677
- package/prebuilds/darwin-arm64/doe_napi.node +0 -0
- package/prebuilds/darwin-arm64/libdoe_webgpu.dylib +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2
|
+
width="100%" viewBox="0 0 1024 912" enable-background="new 0 0 1024 912" xml:space="preserve">
|
|
3
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
4
|
+
d="
|
|
5
|
+
M561.720642,622.786377
|
|
6
|
+
C553.729919,627.969910 546.010742,632.904602 538.369385,637.957031
|
|
7
|
+
C535.816589,639.644958 533.450928,639.890869 530.410156,639.033569
|
|
8
|
+
C496.780701,629.553040 463.095703,620.269409 429.449615,610.847229
|
|
9
|
+
C426.789368,610.102295 424.805511,610.437683 422.541382,612.110107
|
|
10
|
+
C391.322327,635.171021 360.024384,658.125061 328.777100,681.147827
|
|
11
|
+
C326.949310,682.494568 324.665314,683.427673 323.501312,686.239502
|
|
12
|
+
C332.812775,697.053833 342.244049,708.005188 351.672821,718.958740
|
|
13
|
+
C355.911652,723.883118 360.213379,728.755676 364.352844,733.762329
|
|
14
|
+
C366.395416,736.232727 368.639038,736.733826 371.815857,736.326721
|
|
15
|
+
C395.402374,733.303955 419.023499,730.552856 442.621857,727.620361
|
|
16
|
+
C456.483551,725.897827 470.323303,723.998779 484.173126,722.180664
|
|
17
|
+
C486.255676,721.907288 488.363617,721.164978 491.108093,722.817322
|
|
18
|
+
C487.332245,727.182861 483.732910,731.417847 480.055420,735.583801
|
|
19
|
+
C462.526154,755.441467 444.874146,775.192200 427.513458,795.195923
|
|
20
|
+
C423.789734,799.486572 418.971436,798.620178 414.630371,799.096924
|
|
21
|
+
C382.224335,802.655823 349.776764,805.835388 317.347687,809.186890
|
|
22
|
+
C314.016266,809.531250 311.309998,808.870239 308.652527,806.577637
|
|
23
|
+
C293.512878,793.516846 278.267792,780.577148 262.963531,767.709290
|
|
24
|
+
C260.426514,765.575989 259.164886,763.535583 259.918427,760.033569
|
|
25
|
+
C264.604370,738.255676 269.179749,716.453125 273.615570,694.622925
|
|
26
|
+
C274.479248,690.372375 276.427002,687.729614 280.374420,685.634399
|
|
27
|
+
C319.514038,664.859131 358.537842,643.865662 397.604797,622.953308
|
|
28
|
+
C400.812408,621.236328 404.096161,619.661682 407.150513,617.578186
|
|
29
|
+
C393.732697,622.716980 380.298035,627.812378 366.900330,633.003174
|
|
30
|
+
C333.982697,645.756592 301.074982,658.535889 268.189453,671.371765
|
|
31
|
+
C265.848175,672.285645 263.776581,672.206299 261.437622,671.452393
|
|
32
|
+
C246.070526,666.499451 230.683975,661.605286 215.267365,656.808960
|
|
33
|
+
C212.194107,655.852783 210.103867,654.263794 208.742416,651.246216
|
|
34
|
+
C187.855164,604.951904 166.902298,558.687256 145.906128,512.442200
|
|
35
|
+
C144.987503,510.418915 145.157257,508.623322 145.793808,506.672943
|
|
36
|
+
C157.670425,470.283783 169.540680,433.892578 181.402237,397.498535
|
|
37
|
+
C184.754959,387.211609 188.098938,376.921692 191.383820,366.613068
|
|
38
|
+
C191.825394,365.227356 192.462067,363.790863 191.736496,361.545654
|
|
39
|
+
C184.453964,359.555237 176.801498,357.450378 169.141418,355.373566
|
|
40
|
+
C159.671265,352.806030 150.205750,350.220001 140.714081,347.734192
|
|
41
|
+
C138.026398,347.030243 135.910217,345.670532 134.053238,343.621948
|
|
42
|
+
C112.234657,319.551697 90.411766,295.485046 68.485085,271.513458
|
|
43
|
+
C65.887260,268.673370 65.523636,265.257629 64.848785,261.891754
|
|
44
|
+
C56.576641,220.633774 48.364689,179.363693 40.146648,138.094879
|
|
45
|
+
C38.665779,130.658356 37.227734,123.213303 35.690380,115.366211
|
|
46
|
+
C40.433868,114.928268 44.042770,116.909630 47.717518,118.043434
|
|
47
|
+
C99.263542,133.947342 150.750153,150.044006 202.309982,165.902649
|
|
48
|
+
C207.699402,167.560303 211.560791,170.671005 215.235367,174.679153
|
|
49
|
+
C241.804993,203.660690 268.524261,232.505081 295.080139,261.499176
|
|
50
|
+
C297.910065,264.588959 300.303467,265.394440 304.533447,264.020844
|
|
51
|
+
C329.391846,255.948639 354.393036,248.317032 379.308838,240.419434
|
|
52
|
+
C382.485748,239.412445 385.346466,239.393539 388.532715,240.395325
|
|
53
|
+
C421.252045,250.682495 454.005737,260.860382 486.755432,271.050873
|
|
54
|
+
C489.222900,271.818634 491.161682,273.269073 492.938354,275.105591
|
|
55
|
+
C506.840179,289.475433 520.896973,303.698212 534.613708,318.241974
|
|
56
|
+
C537.627380,321.437347 540.515869,321.205933 544.030640,320.376068
|
|
57
|
+
C573.657593,313.380890 603.293335,306.422607 632.920532,299.428467
|
|
58
|
+
C643.606567,296.905823 654.267090,294.274200 664.964844,291.803223
|
|
59
|
+
C666.486206,291.451813 668.108032,290.460999 669.814636,291.591919
|
|
60
|
+
C670.192810,294.030426 668.415833,295.596619 667.317017,297.350250
|
|
61
|
+
C636.976929,345.773132 606.644836,394.201294 576.122803,442.509460
|
|
62
|
+
C573.378540,446.852936 573.123657,450.225891 575.521301,454.824280
|
|
63
|
+
C590.533936,483.616547 605.209656,512.584290 620.125061,541.427734
|
|
64
|
+
C621.919067,544.897034 622.520325,548.027954 621.308167,551.859314
|
|
65
|
+
C617.644714,563.439331 614.236816,575.101990 610.866333,586.771973
|
|
66
|
+
C609.790649,590.496399 607.782532,593.152527 604.463562,595.254456
|
|
67
|
+
C590.248535,604.256714 576.158325,613.456116 561.720642,622.786377
|
|
68
|
+
M389.160492,357.400208
|
|
69
|
+
C377.895325,350.594940 366.583130,343.865631 355.395233,336.935638
|
|
70
|
+
C352.259521,334.993286 349.793701,335.102173 346.783813,337.256500
|
|
71
|
+
C319.826477,356.550690 292.800842,375.749664 265.745667,394.906525
|
|
72
|
+
C263.544037,396.465393 262.329681,398.155731 262.033478,400.936432
|
|
73
|
+
C259.216034,427.388336 256.314209,453.831604 253.309174,480.262817
|
|
74
|
+
C252.844360,484.351013 254.656021,487.205566 257.028107,490.134552
|
|
75
|
+
C275.376831,512.791016 293.711456,535.459351 311.910980,558.235474
|
|
76
|
+
C314.253540,561.167053 316.995422,562.697571 320.491333,563.678040
|
|
77
|
+
C386.520844,582.196045 452.576324,600.625305 518.489746,619.548950
|
|
78
|
+
C527.676208,622.186401 535.468384,622.854553 542.702759,615.858521
|
|
79
|
+
C543.638672,614.953491 544.956970,614.450012 546.077148,613.728088
|
|
80
|
+
C555.126221,607.895935 564.170349,602.055908 573.225342,596.212341
|
|
81
|
+
C572.119995,593.866333 570.705750,592.725342 569.262939,591.600159
|
|
82
|
+
C560.328918,584.632874 551.468567,577.568359 542.430176,570.739441
|
|
83
|
+
C539.547424,568.561401 538.424866,566.530396 539.555725,562.775269
|
|
84
|
+
C542.047974,554.499207 544.070374,546.077332 546.119263,537.674683
|
|
85
|
+
C546.786133,534.939697 548.161682,533.386230 550.904663,532.646423
|
|
86
|
+
C557.971252,530.740662 564.995850,528.676331 572.019470,526.614807
|
|
87
|
+
C578.174683,524.808228 584.305725,522.919434 590.221558,521.135132
|
|
88
|
+
C590.295715,518.215515 589.053711,516.567627 588.162903,514.813843
|
|
89
|
+
C578.734070,496.250458 569.299255,477.690063 559.808594,459.158295
|
|
90
|
+
C558.483154,456.570251 557.825989,453.944122 557.789429,451.028076
|
|
91
|
+
C557.463684,425.041412 557.033997,399.056000 556.730774,373.069092
|
|
92
|
+
C556.698120,370.272583 556.065369,367.962158 554.337524,365.703094
|
|
93
|
+
C547.252747,356.439758 540.328613,347.053741 533.316956,337.734192
|
|
94
|
+
C532.307068,336.391846 531.465698,334.758179 528.940552,334.188080
|
|
95
|
+
C529.409485,336.139984 529.619141,337.603485 530.110901,338.965118
|
|
96
|
+
C533.898621,349.453766 537.650574,359.957184 541.622253,370.376465
|
|
97
|
+
C542.796143,373.455994 543.060059,376.288116 542.416260,379.561615
|
|
98
|
+
C539.176270,396.036377 536.303406,412.583588 533.037476,429.052979
|
|
99
|
+
C532.198181,433.285675 532.293274,437.893341 529.599854,442.109650
|
|
100
|
+
C482.724701,413.845673 436.248322,385.822113 389.160492,357.400208
|
|
101
|
+
M56.569050,140.456726
|
|
102
|
+
C57.268250,143.874146 57.942520,147.296906 58.670532,150.708176
|
|
103
|
+
C65.677315,183.540237 72.641701,216.381531 79.761696,249.189041
|
|
104
|
+
C80.832840,254.124680 81.227097,259.218994 85.018944,263.441406
|
|
105
|
+
C104.823868,285.495239 124.405800,307.749481 144.034897,329.960876
|
|
106
|
+
C145.854980,332.020386 147.803009,333.319489 150.680099,333.860687
|
|
107
|
+
C177.804352,338.962921 204.896912,344.234528 231.987488,349.514313
|
|
108
|
+
C241.745834,351.416138 251.037933,353.534485 260.474915,346.848877
|
|
109
|
+
C269.175598,340.684998 269.619690,341.523285 265.387604,331.394623
|
|
110
|
+
C245.881470,284.710724 226.412018,238.011368 207.056107,191.265106
|
|
111
|
+
C205.715347,188.027054 203.863800,186.261200 200.563248,185.145782
|
|
112
|
+
C160.363266,171.560287 120.209190,157.838913 80.039070,144.164978
|
|
113
|
+
C73.424332,141.913315 66.805107,139.672226 60.154423,137.530396
|
|
114
|
+
C58.289543,136.929840 55.923115,136.065369 56.569050,140.456726
|
|
115
|
+
z"/>
|
|
116
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
117
|
+
d="
|
|
118
|
+
M731.231934,682.461914
|
|
119
|
+
C736.633423,680.504578 737.072327,679.305176 733.911377,674.890747
|
|
120
|
+
C717.714111,652.270508 701.466064,629.686707 685.232239,607.092712
|
|
121
|
+
C674.152527,591.672180 663.097595,576.233704 651.947998,560.863831
|
|
122
|
+
C650.435486,558.778687 650.035583,556.890381 650.816833,554.402344
|
|
123
|
+
C664.624878,510.428223 678.360046,466.431152 692.155151,422.452911
|
|
124
|
+
C692.535828,421.239624 692.594788,419.770050 693.996399,418.885345
|
|
125
|
+
C695.775146,418.608185 696.389282,420.199554 697.320312,421.264954
|
|
126
|
+
C721.212219,448.607300 745.334717,475.754272 768.815857,503.445160
|
|
127
|
+
C774.828674,510.535950 781.631042,514.719055 790.249939,517.647888
|
|
128
|
+
C836.906738,533.502625 883.415283,549.793762 929.977234,565.927734
|
|
129
|
+
C931.684448,566.519287 933.415894,567.041077 936.217712,567.943970
|
|
130
|
+
C947.106567,519.674866 957.898376,471.835693 968.690186,423.996552
|
|
131
|
+
C972.131714,429.442688 972.162231,435.309631 973.138062,440.919861
|
|
132
|
+
C979.203796,475.792755 984.433228,510.825745 991.281860,545.540955
|
|
133
|
+
C994.246094,560.566711 991.265930,574.089050 987.032837,587.948669
|
|
134
|
+
C983.679626,598.927429 980.492371,609.957031 977.277161,620.977478
|
|
135
|
+
C976.657471,623.101196 975.759949,624.940857 974.096680,626.500854
|
|
136
|
+
C952.954529,646.330750 931.828552,666.178223 910.776245,686.103455
|
|
137
|
+
C908.674316,688.092834 906.513794,688.984924 903.652954,688.949951
|
|
138
|
+
C899.545715,688.899719 895.381104,688.465210 891.387939,689.559937
|
|
139
|
+
C890.740234,691.802307 892.010681,693.316650 892.757019,694.925049
|
|
140
|
+
C897.734436,705.651123 902.706238,716.380676 907.817871,727.042908
|
|
141
|
+
C908.992554,729.493164 909.164062,731.544678 907.919678,734.079102
|
|
142
|
+
C903.222778,743.644836 898.566772,753.240356 894.283508,762.995117
|
|
143
|
+
C892.475708,767.112061 890.086304,768.469238 885.566895,768.458862
|
|
144
|
+
C819.580444,768.307983 753.593567,768.361206 687.606750,768.364746
|
|
145
|
+
C665.111267,768.365967 642.615601,768.398621 620.120361,768.325684
|
|
146
|
+
C616.840454,768.315063 613.977173,768.965454 611.194214,770.816589
|
|
147
|
+
C587.340698,786.683594 563.404663,802.426636 539.562012,818.309875
|
|
148
|
+
C536.385132,820.426208 533.213501,821.462402 529.348572,821.449341
|
|
149
|
+
C497.188782,821.340576 465.028351,821.405029 432.868164,821.376282
|
|
150
|
+
C431.258209,821.374817 429.553650,821.838013 427.615570,820.654785
|
|
151
|
+
C428.738312,817.837585 431.083252,815.891113 432.972290,813.740784
|
|
152
|
+
C462.877960,779.697327 493.057037,745.890747 522.634949,711.565857
|
|
153
|
+
C528.071411,705.256897 534.605713,705.750427 541.086548,704.942688
|
|
154
|
+
C579.859314,700.110413 618.661011,695.507141 657.464600,690.925781
|
|
155
|
+
C681.907166,688.039978 706.370056,685.326477 731.231934,682.461914
|
|
156
|
+
M503.772980,757.260376
|
|
157
|
+
C490.344299,772.708374 476.915588,788.156372 463.486877,803.604309
|
|
158
|
+
C476.103638,804.763000 487.897797,804.808472 499.691467,804.749390
|
|
159
|
+
C510.005981,804.697693 520.971497,806.678833 530.450806,803.806396
|
|
160
|
+
C539.932312,800.933350 547.956055,793.198608 556.556702,787.501221
|
|
161
|
+
C558.981445,785.895020 561.790039,784.678650 563.506836,782.197998
|
|
162
|
+
C563.099243,781.457642 562.968811,780.891052 562.613220,780.622437
|
|
163
|
+
C547.470825,769.184448 532.304871,757.777710 517.152832,746.352539
|
|
164
|
+
C515.169067,744.856812 513.806519,745.820129 512.479919,747.346741
|
|
165
|
+
C509.750305,750.487732 506.988220,753.600464 503.772980,757.260376
|
|
166
|
+
z"/>
|
|
167
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
168
|
+
d="
|
|
169
|
+
M442.079773,131.096130
|
|
170
|
+
C457.800568,112.627243 473.291626,94.427544 489.449097,75.444923
|
|
171
|
+
C493.529510,85.120598 497.185028,93.637383 500.719482,102.204109
|
|
172
|
+
C506.495819,116.204674 512.038696,130.304092 518.009521,144.220490
|
|
173
|
+
C520.044678,148.963852 520.779846,153.800201 520.931396,158.775818
|
|
174
|
+
C521.479065,176.751144 521.848450,194.731827 522.347717,212.708771
|
|
175
|
+
C522.424500,215.472504 521.754272,217.874130 520.364868,220.279236
|
|
176
|
+
C513.534912,232.101974 506.721710,243.937576 500.153809,255.906509
|
|
177
|
+
C498.311310,259.264191 496.317963,260.171509 492.587524,259.258820
|
|
178
|
+
C460.289185,251.356903 427.946198,243.637665 395.627441,235.818893
|
|
179
|
+
C389.245697,234.274994 389.202698,234.055267 391.016357,227.726776
|
|
180
|
+
C395.736450,211.256729 400.497772,194.798157 405.120117,178.300674
|
|
181
|
+
C406.180176,174.517181 407.934235,171.279755 410.482666,168.305206
|
|
182
|
+
C420.992371,156.038071 431.403015,143.686111 442.079773,131.096130
|
|
183
|
+
z"/>
|
|
184
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
185
|
+
d="
|
|
186
|
+
M252.998932,712.786987
|
|
187
|
+
C250.317963,725.394775 247.725464,737.587036 245.158737,749.784668
|
|
188
|
+
C243.936020,755.595276 243.508926,755.814148 237.893997,754.554443
|
|
189
|
+
C216.489075,749.752686 195.083923,744.949646 173.643234,740.311829
|
|
190
|
+
C169.245514,739.360596 165.697144,737.598572 162.588989,734.212402
|
|
191
|
+
C153.809341,724.647400 144.771652,715.317749 135.758499,705.969727
|
|
192
|
+
C133.405960,703.529724 132.567398,700.848022 132.547668,697.449341
|
|
193
|
+
C132.463577,682.968018 132.131790,668.487671 131.830811,654.008240
|
|
194
|
+
C131.773529,651.252686 132.100418,648.758423 134.133392,646.643616
|
|
195
|
+
C145.671478,634.641052 157.163727,622.594360 168.693634,610.583862
|
|
196
|
+
C169.240112,610.014587 169.996033,609.646362 170.658371,609.181763
|
|
197
|
+
C173.133591,610.502014 173.506210,612.985535 174.467651,615.005920
|
|
198
|
+
C182.190201,631.234131 189.908066,647.465454 197.451523,663.777222
|
|
199
|
+
C199.122818,667.391174 201.509567,669.478210 205.316818,670.676331
|
|
200
|
+
C221.501770,675.769409 237.583847,681.189636 253.771881,686.272522
|
|
201
|
+
C257.208191,687.351440 258.236877,688.890198 257.385834,692.387329
|
|
202
|
+
C255.775284,699.005371 254.507935,705.706787 252.998932,712.786987
|
|
203
|
+
z"/>
|
|
204
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
205
|
+
d="
|
|
206
|
+
M862.719971,430.887146
|
|
207
|
+
C858.402466,432.035706 854.776245,434.308868 849.628052,434.442932
|
|
208
|
+
C851.871216,412.718262 854.065735,391.465057 856.410034,368.761017
|
|
209
|
+
C878.879822,382.735718 900.196106,395.992981 921.512329,409.250244
|
|
210
|
+
C921.524780,409.751282 921.537170,410.252350 921.549622,410.753387
|
|
211
|
+
C902.062439,417.418610 882.575317,424.083862 862.719971,430.887146
|
|
212
|
+
z"/>
|
|
213
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
214
|
+
d="
|
|
215
|
+
M821.230652,403.927551
|
|
216
|
+
C819.668640,412.961365 820.023743,421.815399 817.718933,431.213898
|
|
217
|
+
C801.171509,421.056610 785.291016,411.308716 769.410522,401.560822
|
|
218
|
+
C769.423279,401.011597 769.436035,400.462341 769.448792,399.913116
|
|
219
|
+
C786.970764,393.854431 804.492676,387.795776 822.784790,381.470795
|
|
220
|
+
C823.206604,389.521515 821.328735,396.452484 821.230652,403.927551
|
|
221
|
+
z"/>
|
|
222
|
+
</svg>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { requestDevice } from '@simulatte/webgpu/compute';
|
|
2
|
+
import { createDoeNamespace } from '@simulatte/webgpu-doe';
|
|
3
|
+
|
|
4
|
+
const doe = createDoeNamespace({ requestDevice });
|
|
5
|
+
const gpu = await doe.requestDevice();
|
|
6
|
+
|
|
7
|
+
const src = gpu.buffer.create({ data: Float32Array.of(1, 2, 3, 4) });
|
|
8
|
+
const dst = gpu.buffer.create({ size: src.size, usage: 'storageReadWrite' });
|
|
9
|
+
|
|
10
|
+
await gpu.kernel.run({
|
|
11
|
+
code: `
|
|
12
|
+
@group(0) @binding(0) var<storage, read> src: array<f32>;
|
|
13
|
+
@group(0) @binding(1) var<storage, read_write> dst: array<f32>;
|
|
14
|
+
|
|
15
|
+
@compute @workgroup_size(4)
|
|
16
|
+
fn main(@builtin(global_invocation_id) gid: vec3u) {
|
|
17
|
+
let i = gid.x;
|
|
18
|
+
dst[i] = src[i] * 2.0;
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
bindings: [src, dst],
|
|
22
|
+
workgroups: 1,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log(await gpu.buffer.read({ buffer: dst, type: Float32Array }));
|
package/package.json
CHANGED
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simulatte/webgpu-doe",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Doe
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Standalone Doe helper namespace for WebGPU-compatible runtimes",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"main": "./src/index.js",
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
7
9
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./src/index.d.ts",
|
|
12
|
+
"default": "./src/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
10
17
|
},
|
|
11
18
|
"files": [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"README.md"
|
|
19
|
+
"assets/",
|
|
20
|
+
"examples/",
|
|
21
|
+
"src/",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md"
|
|
17
25
|
],
|
|
18
26
|
"scripts": {
|
|
19
|
-
"
|
|
27
|
+
"test": "node ./test-node.js",
|
|
28
|
+
"smoke": "node ./test-node.js"
|
|
20
29
|
},
|
|
21
|
-
"os": [
|
|
22
|
-
"darwin"
|
|
23
|
-
],
|
|
24
|
-
"cpu": [
|
|
25
|
-
"arm64"
|
|
26
|
-
],
|
|
27
30
|
"keywords": [
|
|
28
31
|
"webgpu",
|
|
29
32
|
"doe",
|
|
30
|
-
"
|
|
33
|
+
"helpers",
|
|
31
34
|
"compute",
|
|
32
|
-
"
|
|
33
|
-
"node",
|
|
34
|
-
"native",
|
|
35
|
-
"napi",
|
|
36
|
-
"metal",
|
|
37
|
-
"vulkan",
|
|
38
|
-
"zig"
|
|
35
|
+
"wgsl"
|
|
39
36
|
],
|
|
40
37
|
"repository": {
|
|
41
38
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/clocksmith/fawn",
|
|
39
|
+
"url": "git+https://github.com/clocksmith/fawn.git",
|
|
43
40
|
"directory": "nursery/webgpu-doe"
|
|
44
41
|
},
|
|
45
|
-
"
|
|
42
|
+
"homepage": "https://github.com/clocksmith/fawn/tree/main/nursery/webgpu-doe",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/clocksmith/fawn/issues"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"author": "Fawn",
|
|
50
|
+
"license": "Apache-2.0"
|
|
46
51
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export type DoeBufferUsage =
|
|
2
|
+
| "upload"
|
|
3
|
+
| "readback"
|
|
4
|
+
| "uniform"
|
|
5
|
+
| "storageRead"
|
|
6
|
+
| "storageReadWrite";
|
|
7
|
+
|
|
8
|
+
export type DoeWorkgroups = number | [number, number] | [number, number, number];
|
|
9
|
+
|
|
10
|
+
export type DoeBindingAccess = "uniform" | "storageRead" | "storageReadWrite";
|
|
11
|
+
|
|
12
|
+
export interface DoeCreateBufferOptions {
|
|
13
|
+
size?: number;
|
|
14
|
+
usage?: DoeBufferUsage | DoeBufferUsage[] | number;
|
|
15
|
+
data?: ArrayBufferView | ArrayBuffer;
|
|
16
|
+
label?: string;
|
|
17
|
+
mappedAtCreation?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DoeReadBufferSubrangeOptions {
|
|
21
|
+
size?: number;
|
|
22
|
+
offset?: number;
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface DoeReadBufferOptions<T extends ArrayBufferView = ArrayBufferView>
|
|
27
|
+
extends DoeReadBufferSubrangeOptions {
|
|
28
|
+
buffer: unknown;
|
|
29
|
+
type: { new (buffer: ArrayBuffer): T };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DoeBindingBuffer<TBuffer> {
|
|
33
|
+
buffer: TBuffer;
|
|
34
|
+
access?: DoeBindingAccess;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DoeComputeInputDataOptions {
|
|
38
|
+
data: ArrayBufferView | ArrayBuffer;
|
|
39
|
+
usage?: DoeBufferUsage | DoeBufferUsage[];
|
|
40
|
+
access?: DoeBindingAccess;
|
|
41
|
+
label?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type DoeComputeInput<TBuffer> =
|
|
45
|
+
| ArrayBufferView
|
|
46
|
+
| ArrayBuffer
|
|
47
|
+
| TBuffer
|
|
48
|
+
| DoeBindingBuffer<TBuffer>
|
|
49
|
+
| DoeComputeInputDataOptions;
|
|
50
|
+
|
|
51
|
+
export interface DoeComputeOnceOutputOptions<T extends ArrayBufferView> {
|
|
52
|
+
type: { new (buffer: ArrayBuffer): T };
|
|
53
|
+
size?: number;
|
|
54
|
+
likeInput?: number;
|
|
55
|
+
usage?: DoeBufferUsage | DoeBufferUsage[];
|
|
56
|
+
access?: DoeBindingAccess;
|
|
57
|
+
label?: string;
|
|
58
|
+
read?: DoeReadBufferSubrangeOptions;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface DoeComputeOnceOptions<TBuffer, T extends ArrayBufferView> {
|
|
62
|
+
code: string;
|
|
63
|
+
entryPoint?: string;
|
|
64
|
+
inputs?: Array<DoeComputeInput<TBuffer>>;
|
|
65
|
+
output: DoeComputeOnceOutputOptions<T>;
|
|
66
|
+
workgroups: DoeWorkgroups;
|
|
67
|
+
label?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface DoeKernelCreateOptions<TBuffer> {
|
|
71
|
+
code: string;
|
|
72
|
+
entryPoint?: string;
|
|
73
|
+
bindings?: Array<TBuffer | DoeBindingBuffer<TBuffer>>;
|
|
74
|
+
workgroups: DoeWorkgroups;
|
|
75
|
+
label?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface DoeKernelDispatchOptions<TBuffer> {
|
|
79
|
+
bindings?: Array<TBuffer | DoeBindingBuffer<TBuffer>>;
|
|
80
|
+
workgroups: DoeWorkgroups;
|
|
81
|
+
label?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface BoundDoeBufferNamespace<TBuffer> {
|
|
85
|
+
create(options: DoeCreateBufferOptions): TBuffer;
|
|
86
|
+
read<T extends ArrayBufferView>(
|
|
87
|
+
options: DoeReadBufferOptions<T>,
|
|
88
|
+
): Promise<T>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface BoundDoeKernelNamespace<
|
|
92
|
+
TBuffer,
|
|
93
|
+
TKernel,
|
|
94
|
+
TKernelOptions,
|
|
95
|
+
> {
|
|
96
|
+
run(options: TKernelOptions): Promise<void>;
|
|
97
|
+
create(options: TKernelOptions): TKernel;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface BoundDoeNamespace<
|
|
101
|
+
TDevice,
|
|
102
|
+
TBuffer,
|
|
103
|
+
TKernel,
|
|
104
|
+
TKernelOptions,
|
|
105
|
+
> {
|
|
106
|
+
readonly device: TDevice;
|
|
107
|
+
readonly buffer: BoundDoeBufferNamespace<TBuffer>;
|
|
108
|
+
readonly kernel: BoundDoeKernelNamespace<
|
|
109
|
+
TBuffer,
|
|
110
|
+
TKernel,
|
|
111
|
+
TKernelOptions
|
|
112
|
+
>;
|
|
113
|
+
compute<T extends ArrayBufferView>(
|
|
114
|
+
options: DoeComputeOnceOptions<TBuffer, T>,
|
|
115
|
+
): Promise<T>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface DoeNamespace<
|
|
119
|
+
TDevice,
|
|
120
|
+
TBoundDoe,
|
|
121
|
+
TRequestDeviceOptions = unknown,
|
|
122
|
+
> {
|
|
123
|
+
requestDevice(options?: TRequestDeviceOptions): Promise<TBoundDoe>;
|
|
124
|
+
bind(device: TDevice): TBoundDoe;
|
|
125
|
+
}
|