This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
418 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
steps: | ||
- command: "ci/build.sh" | ||
name: "build" | ||
timeout_in_minutes: 30 | ||
timeout_in_minutes: 45 | ||
agents: | ||
- "queue=cuda" |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef INT128_H | ||
#define INT128_H | ||
|
||
struct uint128_t { | ||
uint64_t low; | ||
uint64_t high; | ||
}; | ||
|
||
static __device__ __host__ uint128_t mul_128(uint64_t a, uint64_t b) { | ||
uint128_t result; | ||
#ifdef __CUDA_ARCH__ | ||
result.low = a * b; | ||
result.high = __mul64hi(a, b); | ||
#elif __x86_64__ | ||
asm( "mulq %3\n\t" | ||
: "=a" (result.low), "=d" (result.high) | ||
: "%0" (a), "rm" (b)); | ||
#endif | ||
return result; | ||
} | ||
|
||
static __device__ __host__ uint128_t add_128(uint128_t a, uint128_t b) { | ||
uint128_t result; | ||
#ifdef __CUDA_ARCH__ | ||
asm( "add.cc.u64 %0, %2, %4;\n\t" | ||
"addc.u64 %1, %3, %5;\n\t" | ||
: "=l" (result.low), "=l" (result.high) | ||
: "l" (a.low), "l" (a.high), | ||
"l" (b.low), "l" (b.high)); | ||
#else | ||
result.low = a.low + b.low; | ||
result.high = a.high + b.high + (result.low < a.low); | ||
#endif | ||
return result; | ||
} | ||
|
||
#endif |
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
Oops, something went wrong.