-
Notifications
You must be signed in to change notification settings - Fork 3
Updated GetCurrentArray to use chunkstrides #607
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,14 +69,12 @@ const AnalysisWG = ({ setTexture, }: { setTexture: React.Dispatch<React.SetState | |
| xSlice: state.xSlice | ||
| }))); | ||
| const isMounted = useRef(false) | ||
|
|
||
| useEffect(() => { | ||
| if (!plotOn){ | ||
| return | ||
| } | ||
| const dataArray = GetCurrentArray(analysisStore); | ||
| // Guard clauses: exit if not triggered, no operation is selected, or data is invalid. | ||
| if (!operation || dataArray.length <= 1) { | ||
| if (!operation) { | ||
| return; | ||
| } | ||
| const executeAnalysis = async () => { | ||
|
|
@@ -100,7 +98,7 @@ const AnalysisWG = ({ setTexture, }: { setTexture: React.Dispatch<React.SetState | |
| } | ||
|
|
||
| // --- 2. Dispatch GPU computation based on the operation --- | ||
| const inputArray = analysisMode ? analysisArray : dataArray; | ||
| const inputArray = GetCurrentArray(analysisStore) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By calling |
||
| const shapeInfo = { shape: dataShape, strides}; | ||
| const kernelParams = { kernelDepth, kernelSize }; | ||
| // [1538316, 1481, 1] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -275,8 +275,7 @@ export function GetCurrentArray(overrideStore?:string){ | |||||||||||||||||||||||||||
| const [xStartIdx, xEndIdx] = currentChunks.x | ||||||||||||||||||||||||||||
| const [yStartIdx, yEndIdx] = currentChunks.y | ||||||||||||||||||||||||||||
| const [zStartIdx, zEndIdx] = currentChunks.z | ||||||||||||||||||||||||||||
| let chunkShape; | ||||||||||||||||||||||||||||
| let chunkStride; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| for (let z = zStartIdx; z < zEndIdx; z++) { | ||||||||||||||||||||||||||||
|
Comment on lines
+278
to
279
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||
| for (let y = yStartIdx; y < yEndIdx; y++) { | ||||||||||||||||||||||||||||
| for (let x = xStartIdx; x < xEndIdx; x++) { | ||||||||||||||||||||||||||||
|
|
@@ -285,14 +284,10 @@ export function GetCurrentArray(overrideStore?:string){ | |||||||||||||||||||||||||||
| const chunk = cache.get(cacheName) | ||||||||||||||||||||||||||||
| const compressed = chunk.compressed | ||||||||||||||||||||||||||||
| const thisData = compressed ? DecompressArray(chunk.data) : chunk.data | ||||||||||||||||||||||||||||
| if (!chunkShape) { | ||||||||||||||||||||||||||||
| chunkShape = chunk.shape | ||||||||||||||||||||||||||||
| chunkStride = chunk.stride | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| copyChunkToArray( | ||||||||||||||||||||||||||||
| thisData, | ||||||||||||||||||||||||||||
| chunkShape, | ||||||||||||||||||||||||||||
| chunkStride, | ||||||||||||||||||||||||||||
| chunk.shape, | ||||||||||||||||||||||||||||
| chunk.stride, | ||||||||||||||||||||||||||||
|
Comment on lines
287
to
+290
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By directly passing
Suggested change
|
||||||||||||||||||||||||||||
| typedArray, | ||||||||||||||||||||||||||||
| dataShape, | ||||||||||||||||||||||||||||
| strides as [number, number, number], | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for
dataArray.length <= 1is no longer needed becauseGetCurrentArrayis always called, and the function itself handles cases where the data might be invalid or empty. Removing this check simplifies the logic and avoids potential issues ifdataArrayis unexpectedly empty or has a length of 1.