I've asked a similar question but I did not realize that the question and solution relied on the caption being positioned at the bottom.
Consider the following example:
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\begin{document}
\begin{figure}
\centering
% from caption documentation:
% Please note that position=top does NOT mean that the caption is actually placed at the top of the figure or table
% Instead the caption is usually placed where you place the \caption command.
\captionsetup[subfigure]{singlelinecheck=false,skip=-6pt,position=top}
\begin{subfigure}{0.4\textwidth}
\caption{}
\includegraphics[width=1.0\textwidth]{example-image-a}
\label{fig:a}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\caption{}
\includegraphics[width=1.0\textwidth]{example-image-b}
\label{fig:b}
\end{subfigure}
\end{figure}
\end{document}
The subcaption package mentions options that are described in further detail in the caption documentation. In the source, \caption{} should appear before \includegraphics{... to affect the ordering. Unfortunately, this has an unintended influence that the label is rendered below the figure, which means that the figure occludes it. In the example, I include a skip that partially occludes the labels:
How can I get captions positioned on the top, but within the figure? I am beginning to understand why these answers are so much more involved for captions placed within the top and not the bottom of the figure.

