x86 GAS uses reverse order of destination and source registers compared to Intel documentation. This was very confusing.
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
| cmake_minimum_required(VERSION 3.31.6) | |
| project(libtorch_examples) | |
| set(libtorch_VERSION 2.8.0) | |
| find_package(Torch ${libtorch_VERSION} PATHS ../libtorch_linux) | |
| if(NOT Torch_FOUND) | |
| else() | |
| message(STATUS "libtorch ${libtorch_VERSION} - found") | |
| 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
| vec3 random3(vec3 c) { | |
| float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); | |
| vec3 r; | |
| r.z = fract(512.0*j); | |
| j *= .125; | |
| r.x = fract(512.0*j); | |
| j *= .125; | |
| r.y = fract(512.0*j); | |
| return r-0.5; | |
| } |
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
| let points = [ | |
| { x: 38, y: 136 }, | |
| { x: 65, y: 89 }, | |
| { x: 99, y: 178 }, | |
| { x: 149, y: 93 }, | |
| { x: 191, y: 163 }, | |
| { x: 227, y: 122 }, | |
| { x: 251, y: 132 }, | |
| ]; | |
| let tension = 0.5; |
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
| import 'dart:async'; | |
| Future<void> main() async { | |
| final completer = Completer<bool>(); | |
| final future = completer.future; | |
| completer.complete(true); | |
| print(await future); | |
| print(await future); | |
| } |
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
| // | |
| // Created by tejag on 2024-04-26. | |
| // | |
| #include <cstdint> | |
| #include <cstring> | |
| #include <functional> | |
| #include <iostream> | |
| #include <queue> | |
| #include <syncstream> |
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
| template <typename I> | |
| const char *tcNegSlow(I *out, const I *inp, uint64_t nel) { | |
| constexpr size_t laneSize = simdSize<I>(); | |
| uint16_t concurrency = std::thread::hardware_concurrency(); | |
| uint64_t totalLanes = (nel + laneSize - 1) / laneSize; | |
| uint64_t lanesPerThread = std::max( | |
| uint64_t((totalLanes + concurrency - 1) / concurrency), uint64_t(1) | |
| ); | |
| std::vector<std::future<void>> futures(concurrency); |
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
| template <typename T> class Simd; | |
| #if defined(TC_ARCH_X86) | |
| #include <bits/stdc++.h> | |
| #include <x86intrin.h> | |
| uint16_t simdSize = 128; | |
| uint16_t detectSimdSize() { | |
| if (__builtin_cpu_supports("avx512f")) { |
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
| // | |
| // Created by tejag on 2024-04-26. | |
| // | |
| #include <iostream> | |
| #include <type_traits> | |
| #include <typeinfo> | |
| #include <cstdint> | |
| #include <cxxabi.h> |
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
| // | |
| // Created by tejag on 2024-04-26. | |
| // | |
| #include <cxxabi.h> | |
| #include <experimental/simd> | |
| #include <iostream> | |
| #include <vector> | |
| template <typename T> void printType() { |
NewerOlder