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
/* | |
* atomic memory interlock latency benchmark (public domain) | |
* author: Michael Clark <[email protected]> | |
* c++ -pthread -O2 atomic_latency.cc -o atomic_latency | |
*/ | |
#include <cstdio> | |
#include <thread> | |
#include <atomic> | |
#include <chrono> |
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
/* | |
* PLEASE LICENSE 11/2020, John Smith <[email protected]> | |
* | |
* All rights to this work are granted for all purposes, with exception of | |
* author's implied right of copyright to defend the free use of this work. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
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
// See LICENSE for license details. | |
#include <vector> | |
#include <atomic> | |
#include <thread> | |
#include <mutex> | |
#include <memory> | |
#include <functional> | |
#include <condition_variable> |
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
/* | |
* ftkitty - program that outputs text using kitty image protocol | |
* | |
* meet `ftkitty`, a tiny example emitting graphics to the terminal | |
* using #FreeType, #HarfBuzz, and the #kitty graphics protocol. | |
* this is possible with ImageMagick and icat, but ftkitty is smaller | |
* and mostly it's just an experiment with terminal protocols. | |
* | |
* g++ -O2 examples/ftkitty.cc $(pkg-config --libs freetype2 --libs harfbuzz | |
* --cflags freetype2 --cflags harfbuzz) -o build/ftkitty |
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
commit ac3c81578e760af11732da8f925b87ba7b1f70be | |
Author: Michael Clark <[email protected]> | |
Date: Tue Feb 25 10:45:10 2020 +1300 | |
Perform 2D rectangle intersection test and return topology classes | |
diff --git a/src/geometry.h b/src/geometry.h | |
new file mode 100644 | |
index 000000000000..1b5d890c2f58 | |
--- /dev/null |
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
--- linux-4.19-rc8.orig/arch/riscv/kernel/setup.c 2018-10-15 18:20:24.000000000 +1300 | |
+++ linux-4.19-rc8/arch/riscv/kernel/setup.c 2018-10-19 00:25:54.571772704 +1300 | |
@@ -227,7 +227,9 @@ | |
setup_bootmem(); | |
paging_init(); | |
unflatten_device_tree(); | |
+#ifdef CONFIG_SWIOTLB | |
swiotlb_init(1); | |
+#endif | |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdatomic.h> | |
#include <limits.h> | |
#include <pthread.h> | |
/* | |
* Intel® 64 and IA-32 Architectures Software Developer’s Manual | |
* | |
* Volume 3A - 8.1.1 Guaranteed Atomic Operations |
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
NOTE: - indicates RVC accesible register | |
register usage histogram (gcc 7.0.1 20170321 experimental) -Os newlib | |
~~~~~~~~~~~~~~~~~~~~~~~~ | |
1. a5 15.12% [1711277823] --------------------------------------- | |
2. a2 13.64% [1543505068] ----------------------------------- | |
3. a7 10.38% [1174405192] ========================== | |
4. a4 8.95% [1012926250] ----------------------- | |
5. a6 7.77% [878706830] ==================== | |
6. t4 5.30% [599785556] ============= |
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
u : { [31:12], [11:7] } -> { simm[31:12], rd[4:0] } | |
uj : { [31:12], [11:7] } -> { simm[20|10:1|11|19:12], rd[4:0] } | |
i : { [31:20], [19:15], [11:7] } -> { simm[11:0], rs1[4:0], rd[4:0] } | |
i_sh5 : { [24:20], [19:15], [11:7] } -> { imm[4:0], rs1[4:0], rd[4:0] } | |
i_sh6 : { [25:20], [19:15], [11:7] } -> { imm[5:0], rs1[4:0], rd[4:0] } | |
i_sh7 : { [26:20], [19:15], [11:7] } -> { imm[6:0], rs1[4:0], rd[4:0] } | |
i_csr : { [31:20], [19:15], [11:7] } -> { imm[11:0], rs1[4:0], rd[4:0] } | |
s : { [24:20], [19:15], [11:7] } -> { simm[11:5], rs2[4:0], rs1[4:0], simm[4:0] } | |
sb : { [24:20], [19:15], [11:7] } -> { simm[12|10:5], rs2[4:0], rs1[4:0], |
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
benchmark | system | opt | runtime | instret | |
-------------- | -------------- | -- | ------- | ------- | |
aes | rv-hist-riscv32 | O3 | 189.058 | 4617934394 | |
aes | rv-hist-riscv32 | Os | 183.126 | 4445968109 | |
aes | rv-hist-riscv64 | O3 | 213.185 | 5205137133 | |
aes | rv-hist-riscv64 | Os | 215.497 | 5081405284 | |
aes | rv-sim-riscv32 | O3 | 66.627 | 4617934394 | |
aes | rv-sim-riscv32 | O3 | 66.596 | 4617934394 | |
aes | rv-sim-riscv32 | O3 | 66.35 | 4617934394 | |
aes | rv-sim-riscv32 | O3 | 66.459 | 4617934394 |