[PATCH] R600: Use the CPU type to determine the correct DataLayout
Deucher, Alexander
Alexander.Deucher at amd.com
Wed Feb 20 14:48:00 PST 2013
> -----Original Message-----
> From: Tom Stellard [mailto:tom at stellard.net]
> Sent: Wednesday, February 20, 2013 5:34 PM
> To: cfe-commits at cs.uiuc.edu
> Cc: Deucher, Alexander; Stellard, Thomas
> Subject: [PATCH] R600: Use the CPU type to determine the correct
> DataLayout
I think you mean "GPU Type".
>
> From: Tom Stellard <thomas.stellard at amd.com>
>
> ---
> lib/Basic/Targets.cpp | 107
> +++++++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 99 insertions(+), 8 deletions(-)
>
> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
> index 4e66fe5..5bb57e4 100644
> --- a/lib/Basic/Targets.cpp
> +++ b/lib/Basic/Targets.cpp
> @@ -1373,16 +1373,49 @@ static const unsigned R600AddrSpaceMap[] = {
> 3 // cuda_shared
> };
>
> +static const char *DescriptionStringR600 =
> + "e"
> + "-p:32:32:32"
> + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
> + "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-
> v128:128:128"
> + "-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-
> v2048:2048:2048"
> + "-n32:64";
> +
> +static const char *DescriptionStringR600DoubleOps =
> + "e"
> + "-p:32:32:32"
> + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64"
> + "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-
> v128:128:128"
> + "-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-
> v2048:2048:2048"
> + "-n32:64";
> +
> +static const char *DescriptionStringSI =
> + "e"
> + "-p:64:64:64"
> + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64"
> + "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-
> v128:128:128"
> + "-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-
> v2048:2048:2048"
> + "-n32:64";
> +
> class R600TargetInfo : public TargetInfo {
> + /// \brief The GPU profiles supported by the R600 target.
> + enum CPUKind {
> + GK_NONE,
> + GK_R600,
Technically there should be an R600_DOUBLE_OPS as well, but I'm not sure how important it is at this point.
> + GK_R700,
> + GK_R700_DOUBLE_OPS,
> + GK_EVERGREEN,
> + GK_EVERGREEN_DOUBLE_OPS,
> + GK_NORTHERN_ISLANDS,
> + GK_CAYMAN,
> + GK_SOUTHERN_ISLANDS
> + } CPU;
> +
> public:
> - R600TargetInfo(const std::string& triple) : TargetInfo(triple) {
> - DescriptionString =
> - "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
> - "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32"
> - "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64"
> - "-v96:128:128-v128:128:128-v192:256:256-v256:256:256"
> - "-v512:512:512-v1024:1024:1024-v2048:2048:2048"
> - "-n8:16:32:64";
> + R600TargetInfo(const std::string& triple)
> + : TargetInfo(triple),
> + CPU(GK_R600) {
> + DescriptionString = DescriptionStringR600;
> AddrSpaceMap = &R600AddrSpaceMap;
> }
>
> @@ -1423,6 +1456,64 @@ public:
> return TargetInfo::CharPtrBuiltinVaList;
> }
>
> + virtual bool setCPU(const std::string &Name) {
> + CPU = llvm::StringSwitch<CPUKind>(Name)
> + .Case("r600" , GK_R600)
> + .Case("rv610", GK_R600)
> + .Case("rv620", GK_R600)
> + .Case("rv630", GK_R600)
> + .Case("rv635", GK_R600)
> + .Case("rv670", GK_R600)
Rv670 supports double ops.
> + .Case("rs780", GK_R600)
> + .Case("rs880", GK_R600)
> + .Case("rv710", GK_R700)
> + .Case("rv730", GK_R700)
> + .Case("rv740", GK_R700_DOUBLE_OPS)
> + .Case("rv770", GK_R700_DOUBLE_OPS)
> + .Case("palm", GK_EVERGREEN)
> + .Case("cedar", GK_EVERGREEN)
> + .Case("sumo", GK_EVERGREEN)
> + .Case("sumo2", GK_EVERGREEN)
> + .Case("redwood", GK_EVERGREEN)
> + .Case("juniper", GK_EVERGREEN)
> + .Case("hemlock", GK_EVERGREEN_DOUBLE_OPS)
> + .Case("cypress", GK_EVERGREEN_DOUBLE_OPS)
> + .Case("barts", GK_NORTHERN_ISLANDS)
> + .Case("turks", GK_NORTHERN_ISLANDS)
> + .Case("caicos", GK_NORTHERN_ISLANDS)
> + .Case("cayman", GK_CAYMAN)
> + .Case("aruba", GK_CAYMAN)
> + .Case("SI", GK_SOUTHERN_ISLANDS)
> + .Case("pitcairn", GK_SOUTHERN_ISLANDS)
> + .Case("verde", GK_SOUTHERN_ISLANDS)
> + .Case("oland", GK_SOUTHERN_ISLANDS)
> + .Default(GK_NONE);
> +
> + if (CPU == GK_NONE) {
> + return false;
> + }
> +
> + // Set the correct data layout
> + switch (CPU) {
> + case GK_NONE:
> + case GK_R600:
> + case GK_R700:
> + case GK_EVERGREEN:
> + case GK_NORTHERN_ISLANDS:
> + DescriptionString = DescriptionStringR600;
> + break;
> + case GK_R700_DOUBLE_OPS:
> + case GK_EVERGREEN_DOUBLE_OPS:
> + case GK_CAYMAN:
> + DescriptionString = DescriptionStringR600DoubleOps;
> + break;
> + case GK_SOUTHERN_ISLANDS:
> + DescriptionString = DescriptionStringSI;
> + break;
> + }
> +
> + return true;
> + }
> };
>
> } // end anonymous namespace
> --
> 1.7.8.6
>
More information about the cfe-commits
mailing list