Skip to content

Commit

Permalink
Enable string mode
Browse files Browse the repository at this point in the history
  • Loading branch information
axinging committed Jan 25, 2024
1 parent 92cb1a0 commit b39f505
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/web/lib/wasm/jsep/webgpu/ops/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,11 @@ export const getElementAt =
(name: string, index: number|string, length: number, type?: UniformDataElementType): string => {
if (name.startsWith('uniforms.') && length > 4) {
if (typeof (index) === 'string') {
return `${name}[(${index}) / 4][(${index}) % 4]`;

if (type === 'f16') {
return `${name}[(${index}) / 8][(${index}) % 8 / 4][(${index}) % 8 % 4]`;
} else {
return `${name}[(${index}) / 4][(${index}) % 4]`;
}
} else {
if (type === 'f16') {
return `${name}[${Math.floor(index / 8)}][${Math.floor(index % 8 / 4)}][${index % 8 % 4}]`;
Expand Down

0 comments on commit b39f505

Please sign in to comment.