JSON prebuild export and import broken?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- compilers
Direzione di ricerca
Inizia con createKernelMap e i punti di ingresso toJSON/fromJSON, quindi esamina la gestione di FunctionNode per le funzioni map e le funzioni native. Riproduci la sequenza di esportazione/importazione descritta nell’issue e traccia l’output del fragment shader compilato. L’attività è completata quando un kernel contenente valori restituiti da map e funzioni native personalizzate può essere esportato, importato e compilato senza variabili dei risultati di map mancanti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What is wrong?
To make the loading time faster, I thought to prebuild my kernels once as JSON with toJSON(), and use this JSON to create my MapKernels. But the toJSON() is out of date (not handling native functions correct), and also the intern fromJSON(...) do not work. I tried to patch them, and now I can export, but I don't get the import working.
Additional information: I use a map function with some map return values, and custom native functions.
Where does it happen?
Not specific to a system.
How do we replicate the issue?
- Create a kernel with createKernelMap(...)
- Use at least one map function
- Use at least one native function
- Export the kernel with toJSON()
- Try to create a new kernel with that JSON.
How important is this (1-5)?
2
Expected behavior (i.e. solution)
Should work
Other Comments
After some tests to patch fromJSON(...) I got it working, but the compiled fragment shader complains about complains about the missing map result variables.
Here are my patched functions:
toJSON = function() {
return this.traceFunctionCalls(this.rootNode.name).reverse().map(name => {
const nativeIndex = this.nativeFunctionNames.indexOf(name);
if (nativeIndex > -1) {
return {
name,
source: this.nativeFunctions[nativeIndex].source
};
} else if (this.functionMap[name]) {
return this.functionMap[name].toJSON();
} else {
throw new Error(`function ${ name } not found`);
}
});
}
fromJSON = function(jsonFunctionNodes, FunctionNode) {
this.functionMap = {};
for (let i = 0; i < jsonFunctionNodes.length; i++) {
const jsonFunctionNode = jsonFunctionNodes[i];
if (jsonFunctionNode.settings) {
const functionNode = new FunctionNode(jsonFunctionNode.ast, jsonFunctionNode.settings);
functionNode.triggerImplyArgumentType = this.assignArgumentType.bind(this);
// For some reason the FunctionNode object is missing some members, which I found in the FunctionBuilder.
// I'm not sure, if this is correct, but it works somehow.
for (const key of Object.keys(functionNode)) {
if (functionNode[key] === null && this[key] && typeof this[key] === 'function') {
functionNode[key] = this[key].bind(this);
}
}
this.addFunctionNode(functionNode);
if (functionNode.isSubKernel) {
this.subKernelNodes.push(functionNode);
}
this.functionNodes.push(functionNode);
} else {
this.nativeFunctions.push(jsonFunctionNode);
}
}
return this;
};
- Lingua principale
- JavaScript
- Stelle
- 15.5k
- Fork
- 663
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gpujs/gpu.js
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
-
WebGL backend silently returns all zeros for long-running kernels (no GL error, no context loss)Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Bitwise result not correctAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di gpujs/gpu.js
Issue simili
-
Complexity: Small P-Feature: Projects page ready for merge team role: back end/devOps role: front end size: 0.25pt
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
bellingcat/toolkit#905 ·
-
self-care self-care:docs-build-time-investigator
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
githubnext/gh-aw-cao#14191 ·
I maintainer di solito rispondono entro 1 giorno
-
effort:low impact:medium RAG status: auto-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
mastra-ai/mastra#25229 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sugarlabs/musicblocks#8984 ·
I maintainer di solito rispondono entro 1 giorno