feat(opencl): commandQueue thread-local (prerequisito para paralelismo)#9
Open
joaonery1 wants to merge 2 commits into
Open
feat(opencl): commandQueue thread-local (prerequisito para paralelismo)#9joaonery1 wants to merge 2 commits into
joaonery1 wants to merge 2 commits into
Conversation
added 2 commits
March 16, 2026 21:37
Cada thread agora recebe sua própria cl.CommandQueue criada sob demanda, eliminando o risco de condição de corrida ao compartilhar uma única fila. VglClContext.commandQueue é agora @Property que delega a opencl_context.queue. Script test_threadlocal_queue.py verifica isolamento RF-001 e RF-003.
- .ai/ adicionado ao .gitignore e removido do repositório (pasta local preservada) - doc/decisoes-paralelismo.md: análise técnica do artigo IEEE SCC 2018 e decisão de implementar Activities Parallelism via níveis topológicos do DAG - Makefile_python: rundemo/runfundus corrigidos para caminho e executor atuais
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VglClContext.commandQueueagora é@propertyque delega aopencl_context.queue— sem cópia estáticaopencl_context.queueusathreading.local(): cada thread recebe sua própriacl.CommandQueuecriada sob demandaget_vglClContext_attributes()passaself(instância viva) em vez deself.queue(snapshot)finish_queue()adicionado para flush seguro da fila da thread atualVerificações realizadas
id(commandQueue)em threads distintas são diferentes ✅id(commandQueue)na mesma thread são iguais ✅finish_queue()sem exceção na main thread e em thread sem uso ✅execWorkflow.py SAMPLES/demo.wkspé binariamente idêntica ao baseline ✅vgl_lib/opencl_context.pymodificado (nenhum caller alterado)Test plan
python3 test_threadlocal_queue.py— deve imprimir "OK: todas as verificações passaram"python3 execWorkflow.py SAMPLES/demo.wksp— deve executar sem exceçãogit diff --name-only)Arquivos de planejamento
PRD, TechSpec, Tasks e ADR em
.ai/tasks/prd-threadlocal-queue/.