Java 8, 181 157 156 149149 147 bytes
(M,R,C)->{int z=0,c,f,t;for(;R-->0;)for(c=C;c-->0;z+=f%9/8)for(f=t=9;M[R][c]==8&t-->0;)try{f-=M[R+t/3-1][c+t%3-1]%9/8;}catch(Exception e)finally{continue;}return z;}
-24 bytes thanks to @OlivierGrégoire
-2 bytes thanks to @ceilingcat.
(M,R,C)->{ // Method with integer-matrix as parameter & integer return
int z=0, // Result-counter, starting at 0
c,f,t; // Temp-integers, starting uninitialized
for(;R-->0;) // Loop over the rows:
for(c=C;c-->0 // Inner loop over the columns:
; // After every iteration:
z+=f%9/8) // If the digit in this cell is 8:
// Increase the result-counter by 1
// Else: leave it the same
for(f=t=9; // Reset the flag to 9
M[R][c]==8& // If the current cell contains an 8:
t-->0;) // Inner loop `t` in the range (9, 0]:
try{f-= // Decrease the flag by:
M[R+t/3-1] // If `t` is 0, 1, or 2: Look at the previous row
// Else-if `t` is 3, 4, or 5: Look at the current row
// Else (`t` is 6, 7, or 8): Look at the next row
[c+t%3-1] // If `t` is 0, 3, or 6: Look at the previous column
// Else-if `t` is 1, 4, or 7: Look at the current column
// Else (`t` is 2, 5, or 8): Look at the next column
%9/8; // And if the digit in this cell is 8:
// Decrease the flag-integer by 1
// Else: leave it the same
}catch(Exception e)finally{continue;} // Catch and ignore ArrayIndexOutOfBoundsExceptions
// (try-catchfinally saves bytes in comparison to if-checks)
return z;} // And finally return the counter