Skip to content

Commit

Permalink
Fix mangling of some cl_intel_device_size_avc_motion_estimation
Browse files Browse the repository at this point in the history
functions
  • Loading branch information
aratajew authored and AlexeySotkin committed Jan 22, 2020
1 parent ea8f08b commit 5642686
Show file tree
Hide file tree
Showing 4 changed files with 513 additions and 330 deletions.
59 changes: 54 additions & 5 deletions lib/SPIRV/OCLUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,10 @@ class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
addSamplerArg(1);
} else if (UnmangledName.find(kOCLSubgroupsAVCIntel::Prefix) !=
std::string::npos) {
if (UnmangledName.find("evaluate_with_single_reference") !=
std::string::npos)
if (UnmangledName.find("evaluate_ipe") != std::string::npos)
addSamplerArg(1);
else if (UnmangledName.find("evaluate_with_single_reference") !=
std::string::npos)
addSamplerArg(2);
else if (UnmangledName.find("evaluate_with_multi_reference") !=
std::string::npos) {
Expand All @@ -637,11 +639,19 @@ class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
else if (UnmangledName.find("set_inter_base_multi_reference_penalty") !=
std::string::npos ||
UnmangledName.find("set_inter_shape_penalty") !=
std::string::npos ||
UnmangledName.find("set_inter_direction_penalty") !=
std::string::npos)
addUnsignedArg(0);
else if (UnmangledName.find("set_motion_vector_cost_function") !=
std::string::npos)
addUnsignedArgs(0, 2);
else if (UnmangledName.find("interlaced_field_polarity") !=
std::string::npos)
addUnsignedArg(0);
else if (UnmangledName.find("interlaced_field_polarities") !=
std::string::npos)
addUnsignedArgs(0, 1);
else if (UnmangledName.find(kOCLSubgroupsAVCIntel::MCEPrefix) !=
std::string::npos) {
if (UnmangledName.find("get_default") != std::string::npos)
Expand All @@ -653,15 +663,38 @@ class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
else if (UnmangledName.find("set_single_reference") !=
std::string::npos)
addUnsignedArg(1);
else if (UnmangledName.find("set_dual_reference") != std::string::npos)
addUnsignedArg(2);
else if (UnmangledName.find("set_weighted_sad") != std::string::npos ||
UnmangledName.find("set_early_search_termination_threshold") !=
std::string::npos)
addUnsignedArg(0);
else if (UnmangledName.find("adjust_ref_offset") != std::string::npos)
addUnsignedArgs(1, 3);
else if (UnmangledName.find("set_max_motion_vector_count") !=
std::string::npos ||
UnmangledName.find("get_border_reached") != std::string::npos)
addUnsignedArg(0);
else if (UnmangledName.find("shape_distortions") != std::string::npos ||
UnmangledName.find("shape_motion_vectors") !=
std::string::npos ||
UnmangledName.find("shape_reference_ids") !=
std::string::npos) {
if (UnmangledName.find("single_reference") != std::string::npos) {
addUnsignedArg(1);
EraseSubstring(UnmangledName, "_single_reference");
} else if (UnmangledName.find("dual_reference") !=
std::string::npos) {
addUnsignedArgs(1, 2);
EraseSubstring(UnmangledName, "_dual_reference");
}
} else if (UnmangledName.find("ref_window_size") != std::string::npos)
addUnsignedArg(0);
} else if (UnmangledName.find(kOCLSubgroupsAVCIntel::SICPrefix) !=
std::string::npos) {
if (UnmangledName.find("initialize") != std::string::npos)
if (UnmangledName.find("initialize") != std::string::npos ||
UnmangledName.find("set_intra_luma_shape_penalty") !=
std::string::npos)
addUnsignedArg(0);
else if (UnmangledName.find("configure_ipe") != std::string::npos) {
if (UnmangledName.find("_luma") != std::string::npos) {
Expand All @@ -672,7 +705,23 @@ class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
addUnsignedArgs(7, 9);
EraseSubstring(UnmangledName, "_chroma");
}
}
} else if (UnmangledName.find("configure_skc") != std::string::npos)
addUnsignedArgs(0, 4);
else if (UnmangledName.find("set_skc") != std::string::npos) {
if (UnmangledName.find("forward_transform_enable"))
addUnsignedArg(0);
} else if (UnmangledName.find("set_block") != std::string::npos) {
if (UnmangledName.find("based_raw_skip_sad") != std::string::npos)
addUnsignedArg(0);
} else if (UnmangledName.find("get_motion_vector_mask") !=
std::string::npos) {
addUnsignedArgs(0, 1);
} else if (UnmangledName.find("luma_mode_cost_function") !=
std::string::npos)
addUnsignedArgs(0, 2);
else if (UnmangledName.find("chroma_mode_cost_function") !=
std::string::npos)
addUnsignedArg(0);
}
} else if (UnmangledName == "intel_sub_group_shuffle_down" ||
UnmangledName == "intel_sub_group_shuffle_up") {
Expand Down Expand Up @@ -709,7 +758,7 @@ class OCLBuiltinFuncMangleInfo : public SPIRV::BuiltinFuncMangleInfo {
}
// Auxiliarry information, it is expected that it is relevant at the moment
// the init method is called.
Function *F; // SPIRV decorated function
Function *F; // SPIRV decorated function
std::vector<Type *> ArgTypes; // Arguments of OCL builtin
};

Expand Down
3 changes: 1 addition & 2 deletions lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2429,8 +2429,7 @@ void SPIRVToLLVM::transOCLBuiltinFromInstPreproc(
if (NumImages == 1) {
// Multi reference opcode - remove src image OpVmeImageINTEL opcode
// and replace it with corresponding OpImage and OpSampler arguments
bool IsInterlaced = (Args.size() == 4) ? true : false;
size_t SamplerPos = IsInterlaced ? 3 : 2;
size_t SamplerPos = Args.size() - 1;
Args.erase(Args.begin(), Args.begin() + 1);
Args.insert(Args.begin(), SrcImage->getOperands()[0]);
Args.insert(Args.begin() + SamplerPos, SrcImage->getOperands()[1]);
Expand Down
Loading

0 comments on commit 5642686

Please sign in to comment.