Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
9a00e19
adding support for new arch sm_50
li0nr Aug 25, 2026
1c64719
correctly parsing bfe/bfi immediate.
li0nr Aug 25, 2026
d3a6ddf
addign sm_86!
li0nr Aug 26, 2026
2561103
cvt to bf16
li0nr Aug 26, 2026
7b59cc9
supporting mov packed in parser.
li0nr Aug 26, 2026
a9d55a4
supporting setp.f16
li0nr Aug 27, 2026
ac233be
cvt f32 to f16.
li0nr Aug 27, 2026
3af2b61
cvt.f32.bf16
li0nr Aug 27, 2026
beabd31
.b32 destination support
li0nr Aug 27, 2026
01ae9e8
fma.rn.bf16
li0nr Aug 27, 2026
f8afa7f
cvt bulk fixes f16.
li0nr Aug 27, 2026
f335dc8
supporting setp.f16
li0nr Aug 28, 2026
ea5eb41
fma f16
li0nr Aug 28, 2026
b629f8a
mul f16
li0nr Aug 28, 2026
8fc35f1
add.f16, sub.f16, and neg.f16
li0nr Aug 28, 2026
ab51d99
mma in ocelot
li0nr Aug 29, 2026
232c2cb
neg bf16
li0nr Aug 29, 2026
6def197
b32 fallback f32.
li0nr Aug 30, 2026
38a5884
mov b16, f16 dest, vector operand
li0nr Aug 30, 2026
0a29a4f
max f16
li0nr Sep 2, 2026
7c4f020
ex2 f16
li0nr Sep 2, 2026
059bf51
mma more shapes
li0nr Sep 2, 2026
b672a13
mma tf32, more good
li0nr Sep 2, 2026
afd87e3
Fns added.
li0nr Sep 9, 2026
5ad6354
szext added.
li0nr Sep 9, 2026
97a1014
bmsk added.
li0nr Sep 9, 2026
527f256
lop3 added.
li0nr Sep 10, 2026
ac1cf2d
dp2a/dp4a.
li0nr Sep 10, 2026
5cec974
tanh added.
li0nr Sep 10, 2026
4ed317c
max/min f32.
li0nr Sep 11, 2026
f0ec0e8
add/sub fp and rounding.
li0nr Sep 11, 2026
3803fe8
mul fp and roudning.
li0nr Sep 11, 2026
ec82a24
fma roudning.
li0nr Sep 11, 2026
c714ace
mad using fma.
li0nr Sep 12, 2026
3500d4f
div added.
li0nr Sep 12, 2026
ff112da
rem fixes.
li0nr Sep 12, 2026
0d3c2a0
sad fixes.
li0nr Sep 12, 2026
7189920
and tests.
li0nr Sep 12, 2026
53995a7
or tests.
li0nr Sep 12, 2026
f08c004
xor added.
li0nr Sep 12, 2026
1f02a5b
not tests.
li0nr Sep 12, 2026
e0adc9f
shl tests.
li0nr Sep 12, 2026
cc09fc1
shl adjusted ub.
li0nr Sep 12, 2026
46170e4
shl valid.
li0nr Sep 12, 2026
6aaa382
shr fixes.
li0nr Sep 12, 2026
9dfd0e2
shf fixes.
li0nr Sep 13, 2026
0e65208
rcp adjustments.
li0nr Sep 13, 2026
8d51d2b
sqrt adjustments.
li0nr Sep 13, 2026
0fc3832
rsqrt.
li0nr Sep 13, 2026
2c2fb50
cos, sin rounding fixes.
li0nr Sep 13, 2026
42d4f90
ex2.
li0nr Sep 13, 2026
38576e2
testp.
li0nr Sep 13, 2026
98c7e9f
cvta param.
li0nr Sep 16, 2026
6cbc423
tests correct copysign.
li0nr Sep 16, 2026
d288c13
set fixes.
li0nr Sep 16, 2026
5039c8a
setp.
li0nr Sep 16, 2026
84a1a81
slct.
li0nr Sep 16, 2026
7ff4629
cvt.
li0nr Sep 16, 2026
46adbfe
cvt more stuff per spec.
li0nr Sep 16, 2026
c81830e
isspacep fixes.
li0nr Sep 16, 2026
dafb4bc
bfe.
li0nr Sep 16, 2026
ed1b12c
bfind, bfi fixes.
li0nr Sep 16, 2026
48155b6
isspacep.
li0nr Sep 16, 2026
332802b
issapce cta.
li0nr Sep 16, 2026
6ff17d0
isspace good.
li0nr Sep 17, 2026
6e4d16d
cvta fixes.
li0nr Sep 17, 2026
145ce39
neg.
li0nr Sep 17, 2026
0a41bec
min.
li0nr Sep 17, 2026
b286ffd
max.
li0nr Sep 17, 2026
ae3cf01
popc.
li0nr Sep 17, 2026
411b5a8
add half.
li0nr Sep 17, 2026
a73ad6a
sub half.
li0nr Sep 17, 2026
3e35427
mul half.
li0nr Sep 17, 2026
d531149
fma half.
li0nr Sep 17, 2026
d1523ad
neg half.
li0nr Sep 17, 2026
e8965c9
abs half.
li0nr Sep 17, 2026
82532eb
max/min half.
li0nr Sep 18, 2026
3121fab
max/min half, more things.
li0nr Sep 20, 2026
56fd0e1
tanh for halfs.
li0nr Sep 28, 2026
4b309db
isspace fixes.
li0nr Sep 28, 2026
1c41e02
add fixes.
li0nr Sep 28, 2026
093131d
arithmetic half fixes.
li0nr Sep 28, 2026
04cb697
fma rounding.
li0nr Sep 29, 2026
49a6403
astra review fixes.
li0nr Sep 29, 2026
d659c36
ld.lu
li0nr Sep 29, 2026
c3cdb71
st parser
li0nr Sep 29, 2026
7e26140
parser fixes, agnet found it
li0nr Sep 29, 2026
a5ed9e6
prefetch text stuff.
li0nr Sep 29, 2026
6b9891d
red and atom stuff.
li0nr Sep 30, 2026
4bbc116
just parse memory inst.
li0nr Sep 30, 2026
f96a232
more memory parsing.
li0nr Oct 1, 2026
a5f2388
more memory parsing - mmio parsing
li0nr Oct 1, 2026
e90faa3
m16n8k16, mma.
li0nr Oct 3, 2026
c12dbd7
more mma stuff.
li0nr Oct 5, 2026
4696e54
more mma m8n8k4
li0nr Oct 6, 2026
169381c
more mma m8n8k4 f32
li0nr Oct 6, 2026
0e86454
more mma m8n8k32
li0nr Oct 6, 2026
ac67da0
more mma m16n8k64
li0nr Oct 6, 2026
ed2ba13
mma dense done.
li0nr Oct 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ocelot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ endif()

add_library(${PROJECT_NAME}_executive STATIC ${${PROJECT_NAME}_executive_sources})

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set_source_files_properties(src/executive/CooperativeThreadArray.cpp PROPERTIES COMPILE_OPTIONS -frounding-math)
endif()

set_property(TARGET ${PROJECT_NAME}_executive PROPERTY CXX_STANDARD 14)
set_property(TARGET ${PROJECT_NAME}_executive PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(${PROJECT_NAME}_executive PRIVATE ${${PROJECT_NAME}_DEFINITIONS})
Expand Down
11 changes: 10 additions & 1 deletion ocelot/include/ocelot/executive/CooperativeThreadArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,12 @@ namespace executive {
void eval_AddC(CTAContext &context, const ir::PTXInstruction &instr);
void eval_And(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Atom(CTAContext &context, const ir::PTXInstruction &instr);
void evalAtomicRMW(CTAContext &context, const ir::PTXInstruction &instr,
ir::PTXInstruction::AtomicOperation operation, bool writeback);
void eval_Bar(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Bfi(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Bfind(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Bmsk(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Bfe(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Bra(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Brev(CTAContext &context, const ir::PTXInstruction &instr);
Expand All @@ -472,18 +475,23 @@ namespace executive {
void eval_Cvt(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Cvta(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Div(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Dp(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Ex2(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Exit(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Fma(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Fns(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Mma(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Isspacep(CTAContext &context,
const ir::PTXInstruction &instr);
void eval_Ld(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Ldu(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Lg2(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Lop3(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Mad24(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Mad(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Max(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Membar(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Fence(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Min(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Mov(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Mul24(CTAContext &context, const ir::PTXInstruction &instr);
Expand Down Expand Up @@ -520,6 +528,8 @@ namespace executive {
void eval_Sured(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Sust(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Suq(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Szext(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Tanh(CTAContext &context, const ir::PTXInstruction &instr);
void eval_TestP(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Tex(CTAContext &context, const ir::PTXInstruction &instr);
void eval_Trap(CTAContext &context, const ir::PTXInstruction &instr);
Expand Down Expand Up @@ -562,4 +572,3 @@ namespace executive {
}

#endif

2 changes: 1 addition & 1 deletion ocelot/include/ocelot/executive/EmulatedKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace executive {
TextureVector textures;

/*! A handle to the current scheduler, or 0 if none is executing */
EmulatedKernelScheduler* scheduler;
EmulatedKernelScheduler* scheduler = nullptr;

private:
/*! Maps program counter to the kernel that begins there */
Expand Down
3 changes: 2 additions & 1 deletion ocelot/include/ocelot/executive/EmulatedKernelScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class EmulatedKernelScheduler
const ir::Dim3& ctaDim, ir::PTXU32 sharedMemory, ir::PTXU64 stream);
/*! \brief Get the argument memory for the current context */
ir::PTXU64 argumentMemory() const;
/*! \brief Get the argument memory size for the current context */
ir::PTXU64 argumentMemorySize() const;

private:
class Context
Expand Down Expand Up @@ -123,4 +125,3 @@ class EmulatedKernelScheduler

}


3 changes: 3 additions & 0 deletions ocelot/include/ocelot/executive/EmulatorCallStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class EmulatorCallStack
const RegisterType* registerFilePointer(unsigned int thread) const;
/*! \brief Get a pointer to local memory for a given thread */
void* localMemoryPointer(unsigned int thread);
/*! \brief Test whether an address belongs to any active local frame */
bool isLocalMemoryAddress(unsigned long long address,
unsigned int thread, unsigned int addressBits) const;
/*! \brief Get a pointer to shared memory */
void* sharedMemoryPointer();
/*! \brief Get a pointer to global local memory */
Expand Down
81 changes: 76 additions & 5 deletions ocelot/include/ocelot/ir/PTXInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ namespace ir {
Level_Invalid
};

enum Semantics {
Sc,
AcqRel,
Acquire,
Release,
Relaxed,
Weak,
Semantics_Invalid
};

/*! List of opcodes for PTX instructions */
enum Opcode {
Abs = 0,
Expand All @@ -33,6 +43,7 @@ namespace ir {
Bfe,
Bfi,
Bfind,
Bmsk,
Bra,
Brev,
Brkpt,
Expand All @@ -44,18 +55,24 @@ namespace ir {
Cvt,
Cvta,
Div,
Dp2a,
Dp4a,
Ex2,
Exit,
Fma,
Fns,
Isspacep,
Ld,
Ldu,
Lg2,
Lop3,
Mad24,
Mad,
MadC,
Mma,
Max,
Membar,
Fence,
Min,
Mov,
Mul24,
Expand Down Expand Up @@ -91,6 +108,8 @@ namespace ir {
Sured,
Sust,
Suq,
Szext,
Tanh,
TestP,
Tex,
Tld4,
Expand Down Expand Up @@ -136,13 +155,34 @@ namespace ir {
approx = 8192,//< identify an approximate instruction
ftz = 16384, //< flush to zero
full = 32768, //< full division
nan = 65536, //< return NaN if either input is NaN
xorsign = 131072, //< XOR input sign bits
abs = 262144, //< compare absolute input values
relu = 524288, //< clamp negative floating-point results to zero
rna = 1048576, //< round to nearest, ties away from zero
satfinite = 2097152, //< clamp integer mma result to representable range
Modifier_invalid = 0
};

enum CarryFlag {
None = 0,
CC = 1
};

enum MmaShape {
MmaM16N8K8,
MmaM16N8K16,
MmaM8N8K16,
MmaM16N8K32,
MmaM16N8K4,
MmaM8N8K4,
MmaM8N8K32,
MmaM16N8K64,
MmaM8N8K128,
MmaM16N8K128,
MmaM16N8K256,
MmaShape_Invalid
};

enum Volatility {
Nonvolatile = 0,
Expand Down Expand Up @@ -200,6 +240,7 @@ namespace ir {
Cg = 2,
Cs = 3,
Nc = 4,
Lu = 5,
Wb = 0,
Wt = 1,
CacheOperation_Invalid
Expand Down Expand Up @@ -344,6 +385,7 @@ namespace ir {

public:
static std::string toString( Level );
static std::string toString( Semantics );
static std::string toString( CacheLevel cache );
static std::string toStringLoad( CacheOperation op );
static std::string toStringStore( CacheOperation op );
Expand Down Expand Up @@ -425,6 +467,13 @@ namespace ir {

/*! indicates data type of instruction */
PTXOperand::DataType type;
/*! Second input type for packed dot-product instructions */
PTXOperand::DataType bType;

/*! Shape for MMA instructions */
MmaShape mmaShape;
bool mmaAColumnMajor;
bool mmaBColumnMajor;

/*! Flag containing one or more floating-point modifiers */
unsigned int modifier;
Expand All @@ -441,7 +490,7 @@ namespace ir {

/*! For membar, the visibility level in the thread hierarchy */
Level level;

/*! Shift amount flag for bfind instructions */
bool shiftAmount;

Expand All @@ -468,8 +517,30 @@ namespace ir {

};

/*! For fence, the memory ordering semantics -- deliberately outside the
level/shuffleMode/etc. union above: fence needs both a semantics
AND a level (scope) simultaneously, unlike the other union members
which are each only ever used by instructions with no need for
the others at the same time. */
Semantics semantics;

/*! For atom/red, the optional memory-ordering scope (.cta/.gpu/.sys)
-- deliberately its own field rather than reusing the level/
addressSpace union member above: atom/red already use addressSpace
for their .global/.shared qualifier, so writing scope through the
shared level union slot would alias and corrupt it. */
Level scope;

/*! For call instructions, indicates a tail call */
bool tailCall;

/*! For ld/st, indicates the .mmio memory-mapped-I/O form
(always .sem.sys{.global}) -- deliberately a standalone flag
rather than inferred from semantics/scope alone: a plain
ld.acquire.sys and ld.mmio.acquire.sys produce the same
semantics/scope pair but are syntactically distinct and must
round-trip through the printer differently. */
bool mmio;

/*! If the instruction is predicated, the guard */
PTXOperand pg;
Expand Down Expand Up @@ -503,9 +574,6 @@ namespace ir {
/*! Indicates whether the target address space is volatile */
Volatility volatility;

/*! Is this a divide full instruction? */
bool divideFull;

/*! If cvta instruction, indicates whether destination is
generic address or if source is generic address - true if
segmented address space, false if generic */
Expand Down Expand Up @@ -554,6 +622,10 @@ namespace ir {
/*! Source operand c */
PTXOperand c;

/*! Lookup table and predicate input for lop3 */
PTXOperand immLut;
PTXOperand q;

/* Runtime annotations

The following members are used to annotate the instruction
Expand Down Expand Up @@ -602,4 +674,3 @@ namespace ir {
}

#endif

12 changes: 9 additions & 3 deletions ocelot/include/ocelot/ir/PTXOperand.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace ir {
typedef int32_t PTXS32;
typedef int64_t PTXS64;

typedef _Float16 PTXF16;
typedef float PTXF32;
typedef double PTXF64;

Expand Down Expand Up @@ -62,12 +63,17 @@ namespace ir {
u64,
f16,
f32,
bf16,
tf32,
f64,
b8,
b16,
b32,
b64,
pred
pred,
f16x2,
bf16x2,
s4, u4, b1 // MMA element types; stored in packed b32 registers.
};

/*! Special register names */
Expand Down Expand Up @@ -139,7 +145,8 @@ namespace ir {
enum Vec {
v1 = 1, //< scalar
v2 = 2, //< vector2
v4 = 4 //< vector4
v4 = 4, //< vector4
v8 = 8 //< eight-register MMA fragment
};

enum VectorIndex {
Expand Down Expand Up @@ -285,4 +292,3 @@ namespace std {
}

#endif

11 changes: 10 additions & 1 deletion ocelot/include/ocelot/parser/PTXParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ namespace parser

private:
void _setImmediateTypes();
void _setMovVectorImmediateTypes();
std::string _nameInContext( const std::string& name );

OperandWrapper* _getOperand( const std::string& name );
Expand Down Expand Up @@ -236,6 +237,7 @@ namespace parser
void constantOperand( double value );
void indexedOperand( const std::string& name,
YYLTYPE& location, long long int value );
void vectorOperand( unsigned int elements );
void addressableOperand( const std::string& name,
long long int value, YYLTYPE& location,
bool invert );
Expand All @@ -259,6 +261,10 @@ namespace parser
void vote( int token );
void shuffle( int token );
void level( int token );
void semantics( int token );
void scope( int token );
void mmio( bool condition );
void finalizeMmioAddressSpace();
void permute( int token );
void floatingPointMode( int token );
void defaultPermute();
Expand All @@ -267,6 +273,9 @@ namespace parser
void instruction();
void instruction( const std::string& opcode, int dataType );
void instruction( const std::string& opcode );
void dotType( int token );
void lop3();
void mma( int shape, int accumulatorType, int aType, int bType, int cType, bool aColumnMajor = false, bool bColumnMajor = true );
void tex( int dataType );
void tld4( int dataType );
void callPrototypeName( const std::string& identifier );
Expand Down Expand Up @@ -345,6 +354,7 @@ namespace parser
static ir::PTXInstruction::VoteMode tokenToVoteMode( int );
static ir::PTXInstruction::ShuffleMode tokenToShuffleMode( int );
static ir::PTXInstruction::Level tokenToLevel( int );
static ir::PTXInstruction::Semantics tokenToSemantics( int );
static ir::PTXInstruction::PermuteMode tokenToPermuteMode( int );
static ir::PTXInstruction::FloatingPointMode
tokenToFloatingPointMode( int);
Expand All @@ -366,4 +376,3 @@ namespace parser
}

#endif

Loading
Loading