Commit d56431ec authored by Jean-Matthieu Gallard's avatar Jean-Matthieu Gallard
Browse files

KernelGen AoSoA2 - WiP, add spec file flag

parent 31b5eb94
......@@ -78,6 +78,7 @@ class ArgumentParser:
("useGaussLobatto", ArgType.OptionalBool, "use Gauss Lobatto Quadrature instead of Gauss Legendre"),
("predictorRecompute", ArgType.OptionalBool, "predictor step will recompute the PDE instead of relying on stored values from the picard loop (nonlinear only)"),
("useVectPDE", ArgType.OptionalBool, "use vectorized PDE terms (applies when present to: Flux, NCP, Source, FusedSource and MaterialParam)"),
("useAoSoA2", ArgType.OptionalBool, "use AoSoA[2] data layout in SpaceTimePredictor kernel (WiP: linear only), requires useVectPDE"), #TODO JMG: WiP
("tempVarsOnStack", ArgType.OptionalBool, "put the big scratch arrays on the stack instead of the heap (you can use ulimit -s to increase the stack size)")
]
......
......@@ -98,6 +98,7 @@ class Controller:
"useCERKGuess" : args["useCERKGuess"],
"useSplitCK" : args["useSplitCK"],
"useVectPDE" : args["useVectPDE"],
"useAoSoA2" : args["useAoSoA2"],
"predictorRecompute" : args["predictorRecompute"],
"initialGuess" : "mixedPicard" #TODO JMG put as proper toolkit arg
#"initialGuess" : "default" #TODO JMG put as proper toolkit arg
......
......@@ -40,7 +40,10 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
if self.context["useSplitCK"]:
if self.context["useVectPDE"]:
template = "fusedSPTVI_linear_split_ck_vect_cpp.template"
if self.context["useAoSoA2"]:
template = "fusedSPTVI_linear_split_ck_aosoa2_cpp.template"
else:
template = "fusedSPTVI_linear_split_ck_vect_cpp.template"
else:
template = "fusedSPTVI_linear_split_ck_cpp.template"
......@@ -101,20 +104,31 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
if self.context["isLinear"]:
if self.context["useSplitCK"]:
if self.context["useVectPDE"]: # split_ck vect
if self.context["useFlux"]:
if self.context["useMaterialParam"]:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_or_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nVar, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "flux_y_or_z_sck_vect", "nopf", "gemm")
else:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 1, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 1, 1, 1, "flux_y_sck_vect", "nopf", "gemm")
if self.context["useVectPDE"]:
if self.context["useAoSoA2"]: #split_ck aosoa2
if self.context["useFlux"]:
self.context["matmulConfigs"]["flux_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 1, 1, 1, "flux_x_sck", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof , 1, 1, 1, 1, "flux_y_sck", "nopf", "gemm")
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["flux_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar*nDof, 1, 1, 1, 1, "flux_z_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck_vect"] = MatmulConfig(nDofPad, nVar*nDof*nDof3D, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "gradQ_x_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "gradQ_y_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck_vect"] = MatmulConfig(nDofPad*nVar*nDof, nDof, nDof, nDofPad*nVar*nDof, nDofPad, nDofPad*nVar*nDof, 1, 0, 1, 1, "gradQ_z_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["flux_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof2, 1, 1, 1, 1, "flux_z_sck", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 0, 1, 1, "gradQ_x_sck", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof , nDofPad, nVarPad*nDof , 1, 0, 1, 1, "gradQ_y_sck", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof2, nDofPad, nVarPad*nDof2, 1, 0, 1, 1, "gradQ_z_sck", "nopf", "gemm") # beta, 0 => overwrite C
else:# split_ck vect
if self.context["useFlux"]:
if self.context["useMaterialParam"]:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_or_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nVar, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "flux_y_or_z_sck_vect", "nopf", "gemm")
else:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 1, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 1, 1, 1, "flux_y_sck_vect", "nopf", "gemm")
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["flux_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar*nDof, 1, 1, 1, 1, "flux_z_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck_vect"] = MatmulConfig(nDofPad, nVar*nDof*nDof3D, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "gradQ_x_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "gradQ_y_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck_vect"] = MatmulConfig(nDofPad*nVar*nDof, nDof, nDof, nDofPad*nVar*nDof, nDofPad, nDofPad*nVar*nDof, 1, 0, 1, 1, "gradQ_z_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
else: # split_ck scalar
if self.context["useFlux"]:
self.context["matmulConfigs"]["flux_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 1, 1, 1, "flux_x_sck", "nopf", "gemm")
......
......@@ -699,6 +699,12 @@
"available-for" : ["optimised"],
"title" : "WiP: Use vectorised user function formulations (SoA data layout) for PDE functions related to the terms' options: flux, source, ncp, viscous_flux and fusedsource. Only available for optimised kernels with either split_ck (linear) or predictor_recompute (nonlinear)",
"default" : false
},
"AoSoA2_layout" : {
"type" : "boolean",
"available-for" : ["optimised"],
"title" : "WiP: use AoSoA[2] data layout, requires vectorise_terms true",
"default" : false
}
}
},
......
......@@ -65,6 +65,7 @@ class KernelgeneratorModel:
"useGaussLobatto" : solverContext["basis"] == "lobatto",
"predictorRecompute" : solverContext["predictorRecompute"],
"useVectPDE" : solverContext["useVectPDE"],
"useAoSoA2" : solverContext["useAoSoA2"],
# Optional int parameters (may set redundant flags)
"usePointSources" : solverContext["numberOfPointSources"] if solverContext["numberOfPointSources"] > 0 else -1,
"tempVarsOnStack" : solverContext["tempVarsOnStack"]
......
......@@ -223,6 +223,7 @@ class SolverController:
context["noTimeAveraging_s"] = "true" if kernel.get("space_time_predictor",{}).get("notimeavg",False) else "false"
context["predictorRecompute"] = kernel.get("space_time_predictor",{}).get("predictor_recompute",False)
context["useVectPDE"] = kernel.get("space_time_predictor",{}).get("vectorise_terms",False)
context["useAoSoA2"] = kernel.get("space_time_predictor",{}).get("AoSoA2_layout",False)
context.update(self.buildKernelTermsContext(kernel["terms"]))
return context
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment