From 2fd2cff604074842cd3689adf7ad0252d2f3d15b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 6 Jul 2023 11:26:48 +0300 Subject: [PATCH] Revert "Updated to use coroutines instead", coroutines are not stable enough yet, nor are they cross platform This reverts commit 45e64a99869f31cc49199c21149d37decaa71257. --- vcl/buffer.c.v | 2 +- vcl/kernel.c.v | 2 +- vlas/internal/vblas/dgemm.v | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vcl/buffer.c.v b/vcl/buffer.c.v index 35794ecdf..032ef4aa9 100644 --- a/vcl/buffer.c.v +++ b/vcl/buffer.c.v @@ -43,7 +43,7 @@ fn (b &Buffer) load(size int, ptr voidptr) chan IError { ch <- vcl_error(ret) return ch } - go fn (event &ClEvent, ch chan IError) { + spawn fn (event &ClEvent, ch chan IError) { defer { cl_release_event(event) } diff --git a/vcl/kernel.c.v b/vcl/kernel.c.v index 0f066fcb3..af3e62f77 100644 --- a/vcl/kernel.c.v +++ b/vcl/kernel.c.v @@ -226,7 +226,7 @@ fn (k &Kernel) call(work_sizes []int, lokal_sizes []int) chan IError { ch <- err return ch } - go fn (ch chan IError, event ClEvent) { + spawn fn (ch chan IError, event ClEvent) { defer { cl_release_event(event) } diff --git a/vlas/internal/vblas/dgemm.v b/vlas/internal/vblas/dgemm.v index 6a4555d57..0f4c8c9dd 100644 --- a/vlas/internal/vblas/dgemm.v +++ b/vlas/internal/vblas/dgemm.v @@ -1,6 +1,6 @@ module vblas -import runtime +// import runtime import sync import vsl.float.float64 import math @@ -143,7 +143,7 @@ fn dgemm_parallel(a_trans bool, b_trans bool, m int, n int, k int, a []f64, lda // worker_limit acts a number of maximum concurrent workers, // with the limit set to the number of procs available. - worker_limit := chan int{cap: runtime.nr_jobs()} + // worker_limit := chan int{cap: runtime.nr_jobs()} // wg is used to wait for all mut wg := sync.new_waitgroup() @@ -154,11 +154,11 @@ fn dgemm_parallel(a_trans bool, b_trans bool, m int, n int, k int, a []f64, lda for i := 0; i < m; i += block_size { for j := 0; j < n; j += block_size { - worker_limit <- 0 - go fn [worker_limit] (a_trans bool, b_trans bool, m int, n int, max_k_len int, a []f64, lda int, b []f64, ldb int, mut c []f64, ldc int, alpha f64, i int, j int, mut wg sync.WaitGroup) { + // worker_limit <- 0 + spawn fn (a_trans bool, b_trans bool, m int, n int, max_k_len int, a []f64, lda int, b []f64, ldb int, mut c []f64, ldc int, alpha f64, i int, j int, mut wg sync.WaitGroup) { defer { wg.done() - _ := <-worker_limit + // <-worker_limit } mut leni := block_size