Removed unused code.
PiperOrigin-RevId: 322819694 Change-Id: I1884a4c3af356f34ecefa5249079a8cff1f65b80
This commit is contained in:
parent
84dcaf3aef
commit
0f0e85d768
@ -28,39 +28,6 @@ limitations under the License.
|
|||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
namespace cl {
|
namespace cl {
|
||||||
namespace {
|
|
||||||
std::string GetReadImageFromDataType(DataType data_type) {
|
|
||||||
if (data_type == DataType::FLOAT32) {
|
|
||||||
return "read_imagef";
|
|
||||||
} else if (data_type == DataType::FLOAT16) {
|
|
||||||
return "read_imageh";
|
|
||||||
} else {
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetWriteImageFromDataType(DataType data_type) {
|
|
||||||
if (data_type == DataType::FLOAT32) {
|
|
||||||
return "write_imagef";
|
|
||||||
} else if (data_type == DataType::FLOAT16) {
|
|
||||||
return "write_imageh";
|
|
||||||
} else {
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetImageModifier(AccessType access) {
|
|
||||||
switch (access) {
|
|
||||||
case AccessType::READ:
|
|
||||||
return "__read_only";
|
|
||||||
case AccessType::WRITE:
|
|
||||||
return "__write_only";
|
|
||||||
case AccessType::READ_WRITE:
|
|
||||||
return "__read_write";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
std::string GetCommonDefines(CalculationsPrecision precision) {
|
std::string GetCommonDefines(CalculationsPrecision precision) {
|
||||||
std::string result;
|
std::string result;
|
||||||
@ -76,8 +43,6 @@ std::string GetCommonDefines(CalculationsPrecision precision) {
|
|||||||
result += "#define TO_FLT4 convert_float4\n";
|
result += "#define TO_FLT4 convert_float4\n";
|
||||||
result += "#define TO_ACCUM_TYPE convert_float4\n";
|
result += "#define TO_ACCUM_TYPE convert_float4\n";
|
||||||
result += "#define TO_ACCUM_FLT convert_float\n";
|
result += "#define TO_ACCUM_FLT convert_float\n";
|
||||||
result += "#define READ_IMAGE read_imagef\n";
|
|
||||||
result += "#define WRITE_IMAGE write_imagef\n";
|
|
||||||
break;
|
break;
|
||||||
case CalculationsPrecision::F16:
|
case CalculationsPrecision::F16:
|
||||||
result += "#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n";
|
result += "#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n";
|
||||||
@ -90,8 +55,6 @@ std::string GetCommonDefines(CalculationsPrecision precision) {
|
|||||||
result += "#define TO_FLT4 convert_half4\n";
|
result += "#define TO_FLT4 convert_half4\n";
|
||||||
result += "#define TO_ACCUM_TYPE convert_half4\n";
|
result += "#define TO_ACCUM_TYPE convert_half4\n";
|
||||||
result += "#define TO_ACCUM_FLT convert_half\n";
|
result += "#define TO_ACCUM_FLT convert_half\n";
|
||||||
result += "#define READ_IMAGE read_imageh\n";
|
|
||||||
result += "#define WRITE_IMAGE write_imageh\n";
|
|
||||||
break;
|
break;
|
||||||
case CalculationsPrecision::F32_F16:
|
case CalculationsPrecision::F32_F16:
|
||||||
result += "#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n";
|
result += "#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n";
|
||||||
@ -104,8 +67,6 @@ std::string GetCommonDefines(CalculationsPrecision precision) {
|
|||||||
result += "#define TO_FLT4 convert_half4\n";
|
result += "#define TO_FLT4 convert_half4\n";
|
||||||
result += "#define TO_ACCUM_TYPE convert_float4\n";
|
result += "#define TO_ACCUM_TYPE convert_float4\n";
|
||||||
result += "#define TO_ACCUM_FLT convert_float\n";
|
result += "#define TO_ACCUM_FLT convert_float\n";
|
||||||
result += "#define READ_IMAGE read_imageh\n";
|
|
||||||
result += "#define WRITE_IMAGE write_imageh\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,23 +111,6 @@ LinearStorage& LinearStorage::operator=(LinearStorage&& storage) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LinearStorage::ReadLinearFLT4(const std::string& z_coord) const {
|
|
||||||
if (storage_type_ == LinearStorageType::BUFFER) {
|
|
||||||
return absl::StrCat(name_, "[", z_coord, "]");
|
|
||||||
} else {
|
|
||||||
return absl::StrCat("READ_IMAGE(", name_, ", smp_none, (int2)(", z_coord,
|
|
||||||
", 0))");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LinearStorage::GetDeclaration() const {
|
|
||||||
if (storage_type_ == LinearStorageType::BUFFER) {
|
|
||||||
return absl::StrCat("__global FLT4* ", name_);
|
|
||||||
} else {
|
|
||||||
return absl::StrCat("__read_only image2d_t ", name_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::Status LinearStorage::GetGPUResources(
|
absl::Status LinearStorage::GetGPUResources(
|
||||||
const GPUObjectDescriptor* obj_ptr,
|
const GPUObjectDescriptor* obj_ptr,
|
||||||
GPUResourcesWithValue* resources) const {
|
GPUResourcesWithValue* resources) const {
|
||||||
|
@ -75,9 +75,6 @@ class LinearStorage : public GPUObject {
|
|||||||
LinearStorage& operator=(const LinearStorage&) = delete;
|
LinearStorage& operator=(const LinearStorage&) = delete;
|
||||||
|
|
||||||
void SetName(const std::string& name) { name_ = name; }
|
void SetName(const std::string& name) { name_ = name; }
|
||||||
cl_mem GetMemoryPtr() const { return memory_; }
|
|
||||||
std::string ReadLinearFLT4(const std::string& z_coord) const;
|
|
||||||
std::string GetDeclaration() const;
|
|
||||||
|
|
||||||
absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
|
absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
|
||||||
GPUResourcesWithValue* resources) const override;
|
GPUResourcesWithValue* resources) const override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user