@@ -71,8 +71,8 @@ pub use gpu_prover::*;
7171/// Stores a multilinear polynomial in dense evaluation form.
7272pub struct MultilinearExtensionGpu < ' a , E : ExtensionField > {
7373 /// GPU polynomial data, supporting both base field and extension field
74- pub mle : GpuFieldType ,
75- _phantom : PhantomData < & ' a E > ,
74+ pub mle : GpuFieldType < ' a > ,
75+ _phantom : PhantomData < E > ,
7676}
7777
7878impl < ' a , E : ExtensionField > Default for MultilinearExtensionGpu < ' a , E > {
@@ -122,6 +122,26 @@ impl<'a, E: ExtensionField> MultilinearPolynomial<E> for MultilinearExtensionGpu
122122 fn evaluations_len ( & self ) -> usize {
123123 self . mle . evaluations_len ( )
124124 }
125+
126+ fn bh_signature ( & self ) -> E {
127+ if std:: any:: TypeId :: of :: < E :: BaseField > ( )
128+ != std:: any:: TypeId :: of :: < p3:: goldilocks:: Goldilocks > ( )
129+ {
130+ panic ! ( "GPU backend only supports Goldilocks" ) ;
131+ }
132+
133+ match & self . mle {
134+ GpuFieldType :: Base ( poly) => {
135+ let res: Vec < E > = unsafe { std:: mem:: transmute ( vec ! [ poly. bh_signature( ) ] ) } ;
136+ res[ 0 ]
137+ }
138+ GpuFieldType :: Ext ( poly) => {
139+ let res: Vec < E > = unsafe { std:: mem:: transmute ( vec ! [ poly. bh_signature( ) ] ) } ;
140+ res[ 0 ]
141+ }
142+ GpuFieldType :: Unreachable => unreachable ! ( ) ,
143+ }
144+ }
125145}
126146
127147impl < ' a , E : ExtensionField > MultilinearExtensionGpu < ' a , E > {
@@ -190,23 +210,23 @@ impl<'a, E: ExtensionField> MultilinearExtensionGpu<'a, E> {
190210 }
191211
192212 /// Create from base field GpuPolynomial
193- pub fn from_ceno_gpu_base ( mle_gpu : GpuPolynomial ) -> Self {
213+ pub fn from_ceno_gpu_base ( mle_gpu : GpuPolynomial < ' a > ) -> Self {
194214 Self {
195215 mle : GpuFieldType :: Base ( mle_gpu) ,
196216 _phantom : PhantomData ,
197217 }
198218 }
199219
200220 /// Create from extension field GpuPolynomialExt
201- pub fn from_ceno_gpu_ext ( mle_gpu : GpuPolynomialExt ) -> Self {
221+ pub fn from_ceno_gpu_ext ( mle_gpu : GpuPolynomialExt < ' a > ) -> Self {
202222 Self {
203223 mle : GpuFieldType :: Ext ( mle_gpu) ,
204224 _phantom : PhantomData ,
205225 }
206226 }
207227
208228 /// Method for backward compatibility
209- pub fn from_ceno_gpu ( mle_gpu : GpuPolynomial ) -> Self {
229+ pub fn from_ceno_gpu ( mle_gpu : GpuPolynomial < ' a > ) -> Self {
210230 Self :: from_ceno_gpu_base ( mle_gpu)
211231 }
212232
@@ -266,7 +286,8 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> ProverBackend for Gp
266286 type MultilinearPoly < ' a > = MultilinearExtensionGpu < ' a , E > ;
267287 type Matrix = RowMajorMatrix < E :: BaseField > ;
268288 #[ cfg( feature = "gpu" ) ]
269- type PcsData = BasefoldCommitmentWithWitnessGpu < E :: BaseField , BufferImpl < E :: BaseField > > ;
289+ type PcsData =
290+ BasefoldCommitmentWithWitnessGpu < E :: BaseField , BufferImpl < ' static , E :: BaseField > > ;
270291 #[ cfg( not( feature = "gpu" ) ) ]
271292 type PcsData = <PCS as PolynomialCommitmentScheme < E > >:: CommitmentWithWitness ;
272293
0 commit comments