@stdlib/ndarray-base-unary-tiling-block-size 0.2.2 → 0.2.3

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/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -159,7 +159,7 @@ See [LICENSE][stdlib-license].
159
159
 
160
160
  ## Copyright
161
161
 
162
- Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
162
+ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
163
163
 
164
164
  </section>
165
165
 
@@ -172,8 +172,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
172
172
  [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-unary-tiling-block-size.svg
173
173
  [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-unary-tiling-block-size
174
174
 
175
- [test-image]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml/badge.svg?branch=v0.2.2
176
- [test-url]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml?query=branch:v0.2.2
175
+ [test-image]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml/badge.svg?branch=v0.2.3
176
+ [test-url]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml?query=branch:v0.2.3
177
177
 
178
178
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-unary-tiling-block-size/main.svg
179
179
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-unary-tiling-block-size?branch=main
@@ -185,8 +185,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
185
185
 
186
186
  -->
187
187
 
188
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
189
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
188
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
189
+ [chat-url]: https://stdlib.zulipchat.com
190
190
 
191
191
  [stdlib]: https://github.com/stdlib-js/stdlib
192
192
 
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
- "use strict";var _=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var s=_(function(N,n){
2
- var I={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};n.exports=I
3
- });var a=_(function(v,S){
4
- var i=require('@stdlib/ndarray-base-bytes-per-element/dist'),E=s();function B(u,r){var e,t;return e=i(u),t=i(r),e===null||t===null?E.BLOCK_SIZE_IN_ELEMENTS:e>t?E.BLOCK_SIZE_IN_BYTES/e|0:E.BLOCK_SIZE_IN_BYTES/t|0}S.exports=B
5
- });var l=a();module.exports=l;
1
+ "use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var t=u(function(a,i){
2
+ var s=require('@stdlib/ndarray-base-tiling-block-size/dist');function c(e,r){return s([e,r])}i.exports=c
3
+ });var n=t();module.exports=n;
6
4
  /** @license Apache-2.0 */
7
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../lib/defaults.js", "../lib/main.js", "../lib/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar defaults = {\n\t// Define a default block size (in bytes):\n\t'BLOCK_SIZE_IN_BYTES': 64|0, // 64b is a common cache line size. How applicable the common cache line size is here is debatable, given that, depending on the associated stride(s), the innermost loop may not iterate over adjacent elements. The primary goal is to have a block size in which all data within a block can always fit in (L1) cache, regardless of cache size (i.e., cache-oblivious). For reference, a common L1 cache size is 32kB per core. For best performance, block sizes should be tuned based on system hardware; however, such tuning is not readily available to us here. Without obvious better alternatives, 64b has some theoretical (and practical) underpinning, and it should be good enough for most inputs, especially for ndarrays with near contiguity.\n\n\t// Define a default block size (in elements):\n\t'BLOCK_SIZE_IN_ELEMENTS': 8|0 // 64 bytes / 8 bytes per element (i.e., default element size is same as a double)\n};\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );\nvar defaults = require( './defaults.js' );\n\n\n// MAIN //\n\n/**\n* Returns a loop block size for multi-dimensional array tiled loops.\n*\n* @param {string} dtypeX - input array data type\n* @param {string} dtypeY - output array data type\n* @returns {integer} block size (in units of elements)\n*\n* @example\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\n*/\nfunction unaryBlockSize( dtypeX, dtypeY ) {\n\tvar nbx;\n\tvar nby;\n\n\tnbx = bytesPerElement( dtypeX );\n\tnby = bytesPerElement( dtypeY );\n\tif ( nbx === null || nby === null ) { // e.g., \"generic\" arrays\n\t\treturn defaults.BLOCK_SIZE_IN_ELEMENTS;\n\t}\n\tif ( nbx > nby ) {\n\t\treturn ( defaults.BLOCK_SIZE_IN_BYTES/nbx )|0; // asm type annotation\n\t}\n\treturn ( defaults.BLOCK_SIZE_IN_BYTES/nby )|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nmodule.exports = unaryBlockSize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Resolve a loop block size for multi-dimensional array tiled loops.\n*\n* @module @stdlib/ndarray-base-unary-tiling-block-size\n*\n* @example\n* var unaryBlockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n*\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,CAEd,oBAAuB,GAGvB,uBAA0B,CAC3B,EAKAD,EAAO,QAAUC,ICjCjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAkB,QAAS,wCAAyC,EACpEC,EAAW,IAgBf,SAASC,EAAgBC,EAAQC,EAAS,CACzC,IAAIC,EACAC,EAIJ,OAFAD,EAAML,EAAiBG,CAAO,EAC9BG,EAAMN,EAAiBI,CAAO,EACzBC,IAAQ,MAAQC,IAAQ,KACrBL,EAAS,uBAEZI,EAAMC,EACDL,EAAS,oBAAoBI,EAAM,EAEpCJ,EAAS,oBAAoBK,EAAM,CAC7C,CAKAP,EAAO,QAAUG,ICvBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA",
6
- "names": ["require_defaults", "__commonJSMin", "exports", "module", "defaults", "require_main", "__commonJSMin", "exports", "module", "bytesPerElement", "defaults", "unaryBlockSize", "dtypeX", "dtypeY", "nbx", "nby", "main"]
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar blockSize = require( '@stdlib/ndarray-base-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Returns a loop block size for multi-dimensional array tiled loops.\n*\n* @param {*} dtypeX - input array data type\n* @param {*} dtypeY - output array data type\n* @returns {integer} block size (in units of elements)\n*\n* @example\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\n*/\nfunction unaryBlockSize( dtypeX, dtypeY ) {\n\treturn blockSize( [ dtypeX, dtypeY ] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = unaryBlockSize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Resolve a loop block size for multi-dimensional array tiled loops.\n*\n* @module @stdlib/ndarray-base-unary-tiling-block-size\n*\n* @example\n* var unaryBlockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n*\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAY,QAAS,wCAAyC,EAgBlE,SAASC,EAAgBC,EAAQC,EAAS,CACzC,OAAOH,EAAW,CAAEE,EAAQC,CAAO,CAAE,CACtC,CAKAJ,EAAO,QAAUE,ICXjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "blockSize", "unaryBlockSize", "dtypeX", "dtypeY", "main"]
7
7
  }
@@ -18,6 +18,10 @@
18
18
 
19
19
  // TypeScript Version: 4.1
20
20
 
21
+ /// <reference types="@stdlib/types"/>
22
+
23
+ import { DataType } from '@stdlib/types/ndarray';
24
+
21
25
  /**
22
26
  * Returns a loop block size for multi-dimensional array tiled loops.
23
27
  *
@@ -29,7 +33,7 @@
29
33
  * var bsize = unaryBlockSize( 'float64', 'float64' );
30
34
  * // returns <number>
31
35
  */
32
- declare function unaryBlockSize( dtypeX: string, dtypeY: string ): number;
36
+ declare function unaryBlockSize( dtypeX: DataType, dtypeY: DataType ): number;
33
37
 
34
38
 
35
39
  // EXPORTS //
package/lib/main.js CHANGED
@@ -20,8 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );
24
- var defaults = require( './defaults.js' );
23
+ var blockSize = require( '@stdlib/ndarray-base-tiling-block-size' );
25
24
 
26
25
 
27
26
  // MAIN //
@@ -29,8 +28,8 @@ var defaults = require( './defaults.js' );
29
28
  /**
30
29
  * Returns a loop block size for multi-dimensional array tiled loops.
31
30
  *
32
- * @param {string} dtypeX - input array data type
33
- * @param {string} dtypeY - output array data type
31
+ * @param {*} dtypeX - input array data type
32
+ * @param {*} dtypeY - output array data type
34
33
  * @returns {integer} block size (in units of elements)
35
34
  *
36
35
  * @example
@@ -38,18 +37,7 @@ var defaults = require( './defaults.js' );
38
37
  * // returns <number>
39
38
  */
40
39
  function unaryBlockSize( dtypeX, dtypeY ) {
41
- var nbx;
42
- var nby;
43
-
44
- nbx = bytesPerElement( dtypeX );
45
- nby = bytesPerElement( dtypeY );
46
- if ( nbx === null || nby === null ) { // e.g., "generic" arrays
47
- return defaults.BLOCK_SIZE_IN_ELEMENTS;
48
- }
49
- if ( nbx > nby ) {
50
- return ( defaults.BLOCK_SIZE_IN_BYTES/nbx )|0; // asm type annotation
51
- }
52
- return ( defaults.BLOCK_SIZE_IN_BYTES/nby )|0; // asm type annotation
40
+ return blockSize( [ dtypeX, dtypeY ] );
53
41
  }
54
42
 
55
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-unary-tiling-block-size",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Resolve a loop block size for multi-dimensional array tiled loops.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/ndarray-base-bytes-per-element": "^0.2.1"
33
+ "@stdlib/ndarray-base-tiling-block-size": "^0.1.0"
34
34
  },
35
35
  "devDependencies": {},
36
36
  "engines": {
@@ -65,7 +65,6 @@
65
65
  "utils",
66
66
  "util"
67
67
  ],
68
- "__stdlib__": {},
69
68
  "funding": {
70
69
  "type": "opencollective",
71
70
  "url": "https://opencollective.com/stdlib"
package/lib/defaults.js DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2022 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- 'use strict';
20
-
21
- // MAIN //
22
-
23
- var defaults = {
24
- // Define a default block size (in bytes):
25
- 'BLOCK_SIZE_IN_BYTES': 64|0, // 64b is a common cache line size. How applicable the common cache line size is here is debatable, given that, depending on the associated stride(s), the innermost loop may not iterate over adjacent elements. The primary goal is to have a block size in which all data within a block can always fit in (L1) cache, regardless of cache size (i.e., cache-oblivious). For reference, a common L1 cache size is 32kB per core. For best performance, block sizes should be tuned based on system hardware; however, such tuning is not readily available to us here. Without obvious better alternatives, 64b has some theoretical (and practical) underpinning, and it should be good enough for most inputs, especially for ndarrays with near contiguity.
26
-
27
- // Define a default block size (in elements):
28
- 'BLOCK_SIZE_IN_ELEMENTS': 8|0 // 64 bytes / 8 bytes per element (i.e., default element size is same as a double)
29
- };
30
-
31
-
32
- // EXPORTS //
33
-
34
- module.exports = defaults;