Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-baker committed Aug 30, 2024
1 parent 6b4cc01 commit ffa597e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ local_invocation_index. Tests should avoid assuming there is.
import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { keysOf } from '../../../../../../common/util/data_tables.js';
import { iterRange } from '../../../../../../common/util/util.js';
import { kTextureFormatInfo } from '../../../../../format_info.js';
import { align } from '../../../../../util/math.js';
import { PRNG } from '../../../../../util/prng.js';

import {
kWGSizes,
kPredicateCases,
SubgroupTest,
runComputeTest,
kDataSentinel
kDataSentinel,
} from './subgroup_util.js';

export const g = makeTestGroup(SubgroupTest);
Expand All @@ -45,22 +43,24 @@ function generateInputData(seed: number, num: number, addCounter: boolean): Uint
const index = prng.uniformInt(bound);
//console.log(`bound = ${bound}, index = ${index}`);

return new Uint32Array([...iterRange(num, x => {
if (addCounter && x === 0) {
// Counter should start at 1 to avoid clear value.
return 1;
}
return new Uint32Array([
...iterRange(num, x => {
if (addCounter && x === 0) {
// Counter should start at 1 to avoid clear value.
return 1;
}

if (seed === 0) {
return 0;
} else if (seed === 1) {
return 1;
} else if (seed < 10) {
const bounded = (addCounter ? x + 1 : x) % bound;
return bounded === index ? 0 : 1;
}
return prng.uniformInt(2);
})]);
if (seed === 0) {
return 0;
} else if (seed === 1) {
return 1;
} else if (seed < 10) {
const bounded = (addCounter ? x + 1 : x) % bound;
return bounded === index ? 0 : 1;
}
return prng.uniformInt(2);
}),
]);
}

/**
Expand Down Expand Up @@ -263,4 +263,4 @@ fn main(
);
});

g.test('fragment').unimplemented()
g.test('fragment').unimplemented();
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ local_invocation_index. Tests should avoid assuming there is.
import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { keysOf } from '../../../../../../common/util/data_tables.js';
import { iterRange } from '../../../../../../common/util/util.js';
import { kTextureFormatInfo } from '../../../../../format_info.js';
import { align } from '../../../../../util/math.js';
import { PRNG } from '../../../../../util/prng.js';

import {
kWGSizes,
kPredicateCases,
SubgroupTest,
runComputeTest,
kDataSentinel
kDataSentinel,
} from './subgroup_util.js';

export const g = makeTestGroup(SubgroupTest);
Expand All @@ -45,22 +43,24 @@ function generateInputData(seed: number, num: number, addCounter: boolean): Uint
const index = prng.uniformInt(bound);
//console.log(`bound = ${bound}, index = ${index}`);

return new Uint32Array([...iterRange(num, x => {
if (addCounter && x === 0) {
// Counter should start at 1 to avoid clear value.
return 1;
}
return new Uint32Array([
...iterRange(num, x => {
if (addCounter && x === 0) {
// Counter should start at 1 to avoid clear value.
return 1;
}

if (seed === 0) {
return 0;
} else if (seed === 1) {
return 1;
} else if (seed < 10) {
const bounded = (addCounter ? x + 1 : x) % bound;
return bounded === index ? 1 : 0;
}
return prng.uniformInt(2);
})]);
if (seed === 0) {
return 0;
} else if (seed === 1) {
return 1;
} else if (seed < 10) {
const bounded = (addCounter ? x + 1 : x) % bound;
return bounded === index ? 1 : 0;
}
return prng.uniformInt(2);
}),
]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { assert, iterRange } from '../../../../../../common/util/util.js';
import { Float16Array } from '../../../../../../external/petamoriken/float16/float16.js';
import { kTextureFormatInfo } from '../../../../../format_info.js';
import { GPUTest, TextureTestMixin } from '../../../../../gpu_test.js';
import { FPInterval } from '../../../../../util/floating_point.js';
import { sparseScalarF16Range, sparseScalarF32Range, align } from '../../../../../util/math.js';
import { sparseScalarF16Range, sparseScalarF32Range } from '../../../../../util/math.js';
import { PRNG } from '../../../../../util/prng.js';

export class SubgroupTest extends TextureTestMixin(GPUTest) {}
Expand Down

0 comments on commit ffa597e

Please sign in to comment.