Skip to content
Snippets Groups Projects
Commit edadffbd authored by kotsifa2's avatar kotsifa2
Browse files

Updated the definitions of VISC intrinsics (created three different intrinsics

instead of one with a dimension argument), and updated the DFG2LLVM_NVPTX pass.
parent 5dfb037a
No related branches found
No related tags found
No related merge requests found
......@@ -74,15 +74,38 @@ let TargetPrefix = "visc" in {
* node) in the specified dimension intrinsic -
* i32 llvm.visc.getNodeInstanceID(i8*, i32);
*/
def int_visc_getNodeInstanceID : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty,
llvm_i32_ty], []>;
// def int_visc_getNodeInstanceID : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty,
// llvm_i32_ty], []>;
/* i32 llvm.visc.getNodeInstanceID_[xyz](i8*);
*/
def int_visc_getNodeInstanceID_x : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
def int_visc_getNodeInstanceID_y : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
def int_visc_getNodeInstanceID_z : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
/* Find the number of instances of a dataflow node in the specified dimension
* intrinsic -
* i32 llvm.visc.getNumNodeInstances(i8*, i32);
*/
def int_visc_getNumNodeInstances : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty,
llvm_i32_ty], []>;
// def int_visc_getNumNodeInstances : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty,
// llvm_i32_ty], []>;
/* i32 llvm.visc.getNumNodeInstances_[xyz](i8*);
*/
def int_visc_getNumNodeInstances_x : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
def int_visc_getNumNodeInstances_y : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
def int_visc_getNumNodeInstances_z : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty],
[]>;
/* Find the vector length supported by target architecture
* intrinsic -
......
......@@ -115,21 +115,24 @@ namespace {
}
break;
/*********************** llvm.visc.getNodeInstanceID() ************************/
case Intrinsic::visc_getNodeInstanceID: {
case Intrinsic::visc_getNodeInstanceID_x:
case Intrinsic::visc_getNodeInstanceID_y:
case Intrinsic::visc_getNodeInstanceID_z: {
ArgII = cast<IntrinsicInst>((II->getOperand(0))->stripPointerCasts());
ArgDFNode = Leaf_HandleToDFNodeMap[ArgII];
// A leaf node always has a parent
DFNode* ParentDFNode = DFG.getHandleToDFNodeMap()[ArgII];
// Get specified dimension
// (dim = 0) => x
// (dim = 1) => y
// (dim = 2) => z
ConstantInt * DimConstant = cast<ConstantInt>(II->getOperand(1));
int dim = (int) DimConstant->getSExtValue();
// Get the number associated with the required dimension
// FIXME: The order is important!
// These three intrinsics need to be consecutive x,y,z
uint64_t dim = II->getIntrinsicID() -
Intrinsic::visc_getNodeInstanceID_x;
assert((dim >= 0) && (dim < 3) && "Invalid dimension argument");
// Argument of the function to be called
ConstantInt * DimConstant =
ConstantInt::get(Type::getInt32Ty(getGlobalContext()), dim);
ArrayRef<Value *> Args(DimConstant);
// The following is to find which function to call
......@@ -178,7 +181,9 @@ namespace {
}
break;
/********************** llvm.visc.getNumNodeInstances() ***********************/
case Intrinsic::visc_getNumNodeInstances: {
case Intrinsic::visc_getNumNodeInstances_x:
case Intrinsic::visc_getNumNodeInstances_y:
case Intrinsic::visc_getNumNodeInstances_z: {
//TODO: think about whether this is the best way to go
// there are hw specific registers. therefore it is good to have the intrinsic
......@@ -190,12 +195,16 @@ namespace {
// A leaf node always has a parent
DFNode* ParentDFNode = DFG.getHandleToDFNodeMap()[ArgII];
// Get specified dimension
ConstantInt * DimConstant = cast<ConstantInt>(II->getOperand(1));
int dim = (int) DimConstant->getSExtValue();
// Get the number associated with the required dimension
// FIXME: The order is important!
// These three intrinsics need to be consecutive x,y,z
uint64_t dim = II->getIntrinsicID() -
Intrinsic::visc_getNumNodeInstances_x;
assert((dim >= 0) && (dim < 3) && "Invalid dimension argument");
// Argument of the function to be called
ConstantInt * DimConstant =
ConstantInt::get(Type::getInt32Ty(getGlobalContext()), dim);
ArrayRef<Value *> Args(DimConstant);
// The following is to find which function to call
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment