@@ -435,9 +435,15 @@ struct mem_payload_t<
435435 uint64_t base_offset;
436436 dtype* base_ptr;
437437 uint32_t pitch_in_bytes;
438+ uint32_t height_in_elems;
439+ uint32_t width_in_elems;
440+ uint32_t payload_bytes;
438441
439442 inline mem_payload_t (mem_desc_t & mem_tdesc) {
440443 pitch_in_bytes = mem_tdesc.shape .stride * sizeof (dtype);
444+ width_in_elems = mem_tdesc.shape .x ;
445+ height_in_elems = mem_tdesc.shape .y ;
446+ payload_bytes = width_in_elems * height_in_elems * sizeof (dtype);
441447 uint32_t offset_x = mem_tdesc.coord .x ;
442448 uint32_t offset_y = mem_tdesc.coord .y ;
443449 base_offset = mem_transpose
@@ -448,14 +454,17 @@ struct mem_payload_t<
448454
449455 inline mem_payload_t (
450456 dtype* p,
451- [[maybe_unused]] int surface_width,
452- [[maybe_unused]] int surface_height,
457+ int surface_width,
458+ int surface_height,
453459 int surface_pitch,
454460 int surface_offset_x,
455461 int surface_offset_y) {
456462 pitch_in_bytes = surface_pitch * sizeof (dtype);
457463 uint32_t offset_x = surface_offset_x;
458464 uint32_t offset_y = surface_offset_y;
465+ width_in_elems = surface_width;
466+ height_in_elems = surface_height;
467+ payload_bytes = width_in_elems * height_in_elems * sizeof (dtype);
459468 base_offset = mem_transpose
460469 ? offset_x * pitch_in_bytes + offset_y * sizeof (dtype)
461470 : offset_y * pitch_in_bytes + offset_x * sizeof (dtype);
@@ -466,6 +475,9 @@ struct mem_payload_t<
466475 pitch_in_bytes = mem_tdesc.shape .stride * sizeof (dtype);
467476 uint32_t offset_x = mem_tdesc.coord .x ;
468477 uint32_t offset_y = mem_tdesc.coord .y ;
478+ width_in_elems = mem_tdesc.shape .x ;
479+ height_in_elems = mem_tdesc.shape .y ;
480+ payload_bytes = width_in_elems * height_in_elems * sizeof (dtype);
469481 base_offset = mem_transpose
470482 ? offset_x * pitch_in_bytes + offset_y * sizeof (dtype)
471483 : offset_y * pitch_in_bytes + offset_x * sizeof (dtype);
@@ -474,14 +486,17 @@ struct mem_payload_t<
474486
475487 __XETLA_API void init (
476488 dtype* p,
477- [[maybe_unused]] int surface_width,
478- [[maybe_unused]] int surface_height,
489+ int surface_width,
490+ int surface_height,
479491 int surface_pitch,
480492 int surface_offset_x,
481493 int surface_offset_y) {
482494 pitch_in_bytes = surface_pitch * sizeof (dtype);
483495 uint32_t offset_x = surface_offset_x;
484496 uint32_t offset_y = surface_offset_y;
497+ width_in_elems = surface_width;
498+ height_in_elems = surface_height;
499+ payload_bytes = width_in_elems * height_in_elems * sizeof (dtype);
485500 base_offset = mem_transpose
486501 ? offset_x * pitch_in_bytes + offset_y * sizeof (dtype)
487502 : offset_y * pitch_in_bytes + offset_x * sizeof (dtype);
@@ -492,13 +507,19 @@ struct mem_payload_t<
492507 this ->base_offset = rhs.base_offset ;
493508 this ->base_ptr = rhs.base_ptr ;
494509 this ->pitch_in_bytes = rhs.pitch_in_bytes ;
510+ this ->width_in_elems = rhs.width_in_elems ;
511+ this ->height_in_elems = rhs.height_in_elems ;
512+ this ->payload_bytes = rhs.payload_bytes ;
495513 }
496514
497515 inline mem_payload_t () = default ;
498516 inline this_payload_t & operator =(const this_payload_t & rhs) {
499517 this ->base_offset = rhs.base_offset ;
500518 this ->base_ptr = rhs.base_ptr ;
501519 this ->pitch_in_bytes = rhs.pitch_in_bytes ;
520+ this ->width_in_elems = rhs.width_in_elems ;
521+ this ->height_in_elems = rhs.height_in_elems ;
522+ this ->payload_bytes = rhs.payload_bytes ;
502523 return *this ;
503524 }
504525
0 commit comments