We will use coroutines as custom hyperthreading. We want to be able to dealn with memory as if it were a remote location from where we are fetching data. When issuing a prefetch command we want to switch to a different.
This file contains 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
set queries { | |
{ | |
select sum(lo_extendedprice*lo_discount) as revenu | |
from lineorder, date | |
where lo_orderdate = d_datekey | |
and d_yearmonthnum = 199401 | |
and lo_discount between 4 and 6 | |
and lo_quantity between 26 and 35 | |
} |
This file contains 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
(defmacro with-repeating (threads repetitions &rest body) | |
`(mapc #'sb-thread:join-thread | |
(loop repeat ,threads | |
collect (sb-thread:make-thread | |
(lambda () (loop repeat ,repetitions do ,@body)))))) | |
(defstruct atomic-var | |
(data 0 :type (unsigned-byte 64))) | |
(proclaim '(optimize (safety 0) (speed 3))) |
This file contains 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
(defun subpennant-sym (i) (intern (format nil "subpennant-~D" i))) | |
(defun pennant-type-name (ty i) (intern (format nil "pennant-type-~D" i))) | |
(defmacro def-pennant (ty n) | |
"A pennant is a balanced tree of depth N. (def-pennant 5 integer) expands to | |
; ... define pennant-type-{0..4} | |
(struct pennant-type-5 | |
(node :type integer) | |
(subpennant-0 :type pennant-type-0) |
This file contains 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
https://drive.google.com/file/d/1tMOUrOVqGLixYPdzLMGFH2TGauqmyEta/view?usp=drivesdk |
This file contains 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
(define (test) | |
(import chicken.format simple-loops micro-benchmark vector-lib random-mtzig) | |
(define workload-size 10) | |
(define concurrent-workers 20) | |
(define lookup-array (vector-unfold values 1000000)) | |
(define final-cont 0) |
This file contains 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
> (test) | |
; loading /opt/homebrew/Cellar/chicken/5.2.0/lib/chicken/11/format.so ... | |
; loading /opt/homebrew/Cellar/chicken/5.2.0/lib/chicken/11/simple-loops.so ... | |
A:start | |
B:start | |
A 0:pre | |
B 0:pre | |
A 0:post | |
A 1:pre | |
B 0:post |
This file contains 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
(define (test) | |
(import format) | |
(iqmport simple-loops) | |
(define final-cont 0) | |
(define cont-queue (make-vector 10)) | |
(define cont-queue-front 0) | |
(define cont-queue-back 0) |
This file contains 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
(import format) | |
(define (test) | |
(define cont-queue (vector-unfold values 10)) | |
(define cont-queue-front 0) | |
(define cont-queue-back 0) | |
(define (cont-queue-size) | |
(- cont-queue-front cont-queue-back)) |
This file contains 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
#include <cstdint> | |
#include <vector> | |
#include <atomic> | |
#include <optional> | |
// The vectors here are explicitly oragnized as pages. The kernel does | |
// not provide a way for userland to remap pages, so we remap them by | |
// hand instead of copying data when concatenating. Specifically we | |
// create a vector of references to pages that will be read only |
NewerOlder