Skip to content

Commit

Permalink
Minor fixes and refactors
Browse files Browse the repository at this point in the history
This commit aims to address some potentially problematic places in the
codebase.
  • Loading branch information
smilczek authored and igcbot committed Jan 5, 2024
1 parent 448c9ec commit f3c4356
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 12 deletions.
10 changes: 5 additions & 5 deletions visa/CFGStructurizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef std::map<ANode *, ANode *> ANodeMap;
// ANode base, abstract class
class ANode {
public:
uint32_t anodeId;
uint32_t anodeId = 0;
ANodeType type;
ANList preds;
ANList succs;
Expand Down Expand Up @@ -140,8 +140,8 @@ class ANode {

private:
// copy-ctor and assignment operator are not allowed
ANode(const ANode &);
ANode &operator=(const ANode &);
ANode(const ANode &) = delete;
ANode &operator=(const ANode &) = delete;
};

// ANodeBB : ANode for a single BB
Expand All @@ -160,10 +160,10 @@ class ANodeBB : public ANode {
// endif (join)
// label0:
//
bool isJmpiTarget;
bool isJmpiTarget = false;

explicit ANodeBB()
: ANode(AN_BB), bb(nullptr), type(ANODEBB_NORMAL), isJmpiTarget(false) {}
: ANode(AN_BB), bb(nullptr), type(ANODEBB_NORMAL) {}
explicit ANodeBB(G4_BB *b) : ANode(AN_BB), bb(b), type(ANODEBB_NORMAL) {}
virtual ~ANodeBB() {}

Expand Down
2 changes: 1 addition & 1 deletion visa/Common_BinaryEncoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class BinInst {
uint32_t instNumber; // Global instruction number
bool compacted = false;

uint64_t genOffset;
uint64_t genOffset = 0;

BinInst() {
DWords[0] = 0;
Expand Down
2 changes: 1 addition & 1 deletion visa/DebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class KernelDebugInfo {
};

class SaveRestoreInfo {
G4_INST* i = nullptr;
G4_INST *i = nullptr;

public:
// Map src GRF->GRF/Memory
Expand Down
3 changes: 3 additions & 0 deletions visa/G4_Kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ class G4_Kernel {
uint32_t funcId, unsigned char major, unsigned char minor);
~G4_Kernel();

G4_Kernel(const G4_Kernel &) = delete;
G4_Kernel& operator=(const G4_Kernel &) = delete;

TARGET_PLATFORM getPlatform() const { return platformInfo.platform; }
PlatformGen getPlatformGeneration() const { return platformInfo.family; }
const char *getGenxPlatformString() const {
Expand Down
2 changes: 1 addition & 1 deletion visa/GraphColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class LiveRange final {
unsigned numRegNeeded;
unsigned degree = 0;
unsigned refCount = 0;
unsigned parentLRID;
unsigned parentLRID = 0;
AssignedReg reg;
float spillCost = 0.0f;
BankConflict bc = BANK_CONFLICT_NONE;
Expand Down
2 changes: 1 addition & 1 deletion visa/Passes/StaticProfiling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StaticCycleProfiling {
G4_Kernel &kernel;
std::vector<InstCycle> tokenInsts;
std::vector<DistPipeInsts> distInsts;
LatencyTable *LT;
LatencyTable *LT = nullptr;

unsigned BBStaticCycleProfiling(G4_BB *bb);

Expand Down
2 changes: 1 addition & 1 deletion visa/iga/IGALibrary/Backend/Messages/MessageDecoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct MessageDecoder {
}

void
setScatterGatherOp(const std::string& msgSym, const std::string& msgDesc, SendOp op,
setScatterGatherOp(const std::string &msgSym, const std::string &msgDesc, SendOp op,
AddrType addrType, SendDesc surfaceId, int addrSize,
int bitsPerElem, int elemsPerAddr, int simd,
MessageInfo::Attr extraAttrs = MessageInfo::Attr::NONE) {
Expand Down
4 changes: 2 additions & 2 deletions visa/iga/IGALibrary/Backend/Messages/MessageDecoderHDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ struct MessageDecoderHDC : MessageDecoderLegacy {
//

// allows different data sizes in mem and reg
void setHdcMessageX(const std::string& msgSym, const std::string& msgDesc, SendOp op,
void setHdcMessageX(const std::string &msgSym, const std::string &msgDesc, SendOp op,
int addrSizeBits, int bitsPerElemReg, int bitsPerElemMem,
int elemsPerAddr, int execSize,
MessageInfo::Attr extraAttrs) {
Expand Down Expand Up @@ -429,7 +429,7 @@ struct MessageDecoderHDC : MessageDecoderLegacy {
elemsPerAddr, execSize, extraAttrs);
}

void setHdcOwBlock(const std::string& msgSym, const std::string& msgDesc, SendOp op,
void setHdcOwBlock(const std::string &msgSym, const std::string &msgDesc, SendOp op,
int addrSize, MessageInfo::Attr extraAttrs) {
enum MDC_A64_DB_OW {
OW1L = 0x0,
Expand Down
17 changes: 17 additions & 0 deletions visa/iga/IGALibrary/IR/BitSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ template <typename I = uint32_t> class BitSet {
return *this;
}

BitSet<I> &operator=(BitSet<I> &&rhs) {
if (this == &rhs) {
return *this;
}
if (words) {
delete[] words;
}

N = rhs.N;
wordsSize = rhs.wordsSize;
words = rhs.words;

rhs.words = nullptr;

return *this;
}

~BitSet() {
if (words) {
delete[] words;
Expand Down
3 changes: 3 additions & 0 deletions visa/iga/IGALibrary/IR/RegDeps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ class DepSetBuilder {
delete ds;
}

DepSetBuilder(const DepSetBuilder &) = delete;
DepSetBuilder &operator=(const DepSetBuilder &) = delete;

public:
// DepSet creater
/// createSrcDepSet - create DepSet for src operands of instruction i
Expand Down

0 comments on commit f3c4356

Please sign in to comment.